Skip to content

[internal] Add explicit type annotations to components#705

Merged
michaldudak merged 4 commits intomui:masterfrom
michaldudak:type-components-explicitly
Oct 10, 2024
Merged

[internal] Add explicit type annotations to components#705
michaldudak merged 4 commits intomui:masterfrom
michaldudak:type-components-explicitly

Conversation

@michaldudak
Copy link
Member

Components defined as functions (i.e. without forwardRef) with added propTypes ends up having an unexpected type in resulting .d.ts (as described in #651). This also causes #622.
Adding an explicit type annotation solves both of these problems.

Closes #622
Closes #651

@mui-bot
Copy link

mui-bot commented Oct 4, 2024

Netlify deploy preview

https://deploy-preview-705--base-ui.netlify.app/

Generated by 🚫 dangerJS against 2acf3e5

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 7, 2024
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 7, 2024
Copy link
Contributor

@atomiks atomiks left a comment

Choose a reason for hiding this comment

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

Isn't typing props directly now redundant since it's typed with React.FC now?

@michaldudak
Copy link
Member Author

Yup, I just removed them.

@michaldudak michaldudak enabled auto-merge (squash) October 10, 2024 07:42
@michaldudak michaldudak merged commit bde120f into mui:master Oct 10, 2024
@oliviertassinari oliviertassinari added internal Behind-the-scenes enhancement. Formerly called “core”. and removed core labels Aug 2, 2025
@michaldudak michaldudak deleted the type-components-explicitly branch January 9, 2026 08:38
@oliviertassinari oliviertassinari changed the title [core] Add explicit type annotations to components [internal] Add explicit type annotations to components Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Behind-the-scenes enhancement. Formerly called “core”. typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[internal] Clean up Component.propTypes: any from the types [all components] TypeScript accepts arbitrary props on Root parts

4 participants