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

Correct types of component labels #2736

Merged
merged 5 commits into from
Sep 28, 2023
Merged

Conversation

Janpot
Copy link
Member

@Janpot Janpot commented Sep 28, 2023

Avoid using as string, it's reducing type safety, we can just narrow down the type.

@Janpot Janpot added the core Infrastructure work going on behind the scenes label Sep 28, 2023
} & Omit<FormControlLabelProps, 'control' | 'onChange'> &
Omit<CheckboxProps, 'onChange'> &
Pick<FormInputComponentProps, 'name' | 'isRequired' | 'isInvalid'>;
export type CheckboxProps = Omit<FormControlLabelProps, 'control' | 'onChange'> &
Copy link
Member Author

Choose a reason for hiding this comment

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

aligning coding style with the rest of the components

@Janpot Janpot marked this pull request as ready for review September 28, 2023 16:27
@Janpot Janpot requested a review from a team September 28, 2023 16:27
Copy link
Member

@apedroferreira apedroferreira left a comment

Choose a reason for hiding this comment

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

Right, this is definitely better, that as there wasn't really correct.

@apedroferreira
Copy link
Member

apedroferreira commented Sep 28, 2023

Oh, just an optional thing we can also improve: as we don't have to omit the label type from the original component props, the omission there for value and onChange can also be removed if we want to since those prop types are overriden.

Nevermind it depends on the case, not always true (depends on how the types that are united intersect).

@Janpot Janpot merged commit 10b2dc6 into mui:master Sep 28, 2023
11 checks passed
@Janpot Janpot deleted the remove-label-from-form branch September 28, 2023 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants