Discussion: Add typescript types
See original GitHub issueAdd typescript types: Typescript definition files would provide better documentation built into our editors themselves.
Detailed description
This is more of a discussion rather than an issue itself. We’ve started using typescript over many of our apps and I’m trying to identify what we can do to add more documentation wherever we can. I’ve found a library react-to-typescript-definitions that provides some ability to generate types from prop types. However, the library doesn’t fit to some of our setup and we have a few exceptions that aren’t supported by the tool. We would need to manually edit the output somewhat.
How do people feel about supporting type definition files? I was thinking that each component would have a type file (types.d.ts
) within the directory to explain it’s exports. We would need to do some processing on those files to combine in to a single types definition.
Thoughts?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:35 (16 by maintainers)
Top GitHub Comments
I ported the project to TypeScript so that folks can play with writing types (for DefinitelyTyped or otherwise). It has jest/storybook/compile configured for both ts/js files.
https://github.com/vpicone/carbon-components-react/tree/ts
I’m working my way through the components alphabetically in my spare time to uncover any PropType inconsistencies.
Hey - Definitely Typed maintainer here. I’d be happy to help getting this into DT. Raise a PR and ping me and I’ll help with the merge process 👍