-
Notifications
You must be signed in to change notification settings - Fork 322
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: warn deprecated props #2154
Conversation
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.
as it is a hook, maybe the folder name should imply to it?
|
||
type DeprecatedProps = Record<string, string>; | ||
|
||
export function useWarnDeprecatedProps<T extends Record<string, any>>( |
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.
you made it generic but haven't used it as generic in any of the usages, is it needed?
|
||
export function useWarnDeprecatedProps<T extends Record<string, any>>( | ||
props: T, | ||
deprecatedProps: DeprecatedProps, |
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.
maybe alternativeProps? or something similar? it implies for old props, not new one
Object.keys(deprecatedProps).forEach(prop => { | ||
if (prop in props && props[prop] !== undefined) { | ||
console.warn( | ||
`${componentName}: '${prop}' prop is deprecated and will be removed in the next major version. Use '${deprecatedProps[prop]}' instead. [monday-ui-react-core]` |
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.
`${componentName}: '${prop}' prop is deprecated and will be removed in the next major version. Use '${deprecatedProps[prop]}' instead. [monday-ui-react-core]` | |
`[monday-ui-react-core] ${componentName}: '${prop}' prop is deprecated and will be removed in the next major version. Use '${deprecatedProps[prop]}' instead.` |
Just a suggestion, for you to decide
Decided not to do |
https://monday.monday.com/boards/3532714909/pulses/6751163668