-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(js-ts): Convert app/components/UI/SettingsNotification/index.js to TypeScript #11339
base: main
Are you sure you want to change the base?
Conversation
…faultProps in SettingsNotification
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
interface SettingsNotificationProps { | ||
style?: StyleProp<ViewStyle>; | ||
isWarning?: boolean; | ||
isNotification?: boolean; | ||
children?: React.ReactNode; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are all these props optional? It seems from the component body that if isNotification
is true
then style
is required.
It would also seem that children
is required as there is no condition check such as { children.length > 0 && children }
Hard to anticipate, I'm aware. However, as a developer, when I come to import and use this component I won't get a TypeScript warning that a prop is missing, which defeats the purpose of using TypeScript to check props that are necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Daniel-Cross Thanks for pointing these out. I have made the children
prop as necessary. However, style
is breaking existing test cases; that's why I made it optional only. Since it won't be required when isNotification
is false,
this can't be made required straightforwardly in the interface. Maybe we can add extra validation for this when isNotification
is true
Triggering CI rerun |
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Link to Devin run: https://preview.devin.ai/devin/b44f5f30e5ac4f9bb3f19ec2b4bf235f
If you have any feedback, you can leave comments in the PR and I'll address them in the app!