-
Notifications
You must be signed in to change notification settings - Fork 646
TypeScript types #490
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
TypeScript types #490
Conversation
|
That's a cool thing! I'll subscribe to updates, will be waiting :) P.S. Thanks for your work |
|
Really excited about this! |
|
Done, I have now typed all components! 🎉 This is ready for a review 👍 |
|
|
||
| export const UnderlineNav: React.FunctionComponent<UnderlineNavProps> | ||
|
|
||
| export const theme: Object |
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.
Note that the theme should be properly typed, but that would be a lot of effort 😅 I think this is good enough ™️ for a TypeScript MVP, and we can always improve this later.
|
|
||
| #### Merge checklist | ||
| - [ ] Changed base branch to release branch | ||
| - [ ] Add or update TypeScript definitions (`index.d.ts`) if 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.
I added this little reminder to ensure the TypeScript definitions stay up to date, even when new components are added or old ones changed—happy to remove that again if you think it's unnecessary
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.
This looks great, thanks for adding @mxstbr! I don't think we'll get around to re-writing the library with TS anytime soon but this is a good start 👍
Adds TypeScript types to the components, so that any consumer only has to install the package and will automatically get the types. These were extracted from our internal project where I typed all the components we are currently using.
TODO
import Flex from '@primer/components/src/Flex'), we will need to update the types to also type the exportsCloses #389
I think it might be worth having a discussion on whether the package itself should be written in TypeScript, but that would be a much bigger change and this gets us 100% of the way there for all consumers.
Merge checklist