Skip to content
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

Closed
wants to merge 3 commits into from
Closed

Conversation

talkor
Copy link
Member

@talkor talkor commented Jun 2, 2024

@talkor talkor requested a review from a team as a code owner June 2, 2024 09:38
Copy link
Contributor

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>>(
Copy link
Contributor

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,
Copy link
Contributor

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]`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`${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

@talkor
Copy link
Member Author

talkor commented Jun 9, 2024

Decided not to do

@talkor talkor closed this Jun 9, 2024
@talkor talkor deleted the chore/warn-deprecated-props branch August 22, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants