-
Notifications
You must be signed in to change notification settings - Fork 535
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
Replace index.d.ts with generated type definitions #1147
Conversation
🦋 Changeset detectedLatest commit: db47820 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/primer/primer-components/71dkPf5BtMmpWeFP8dTzMfV9YDHc |
f7bdcbf
to
1c7ea7f
Compare
f66e4bc
to
1c7ea7f
Compare
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.
Sorry, didn't realize this was a Draft PR before I started reviewing 😄 . Ignore anything you already have fixed up
Co-Authored-By: @dgreif
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.
Awesome work, this is a major accomplishment! 🏆 🚀
Problem
Primer React was originally released without TypeScript type definitions, making it difficult for engineers to consume the library in TypeScript applications. In July 2019, we created an ambient declaration file (
index.d.ts
) file to provide type definitions for TypeScript applications without having to rewrite Primer React components in TypeScript.index.d.ts
has been an effective stopgap, enabling teams to build complex applications with Primer React and TypeScript. However, becauseindex.d.ts
is disconnected from the implementation code, we've struggled to keep the type definitions up-to-date and accurate, as evidenced by many TypeScript bug reports. As the library continues to grow in size and complexity, manually maintaining type definitions will become unsustainable.Solution
Now that all our components have been rewritten in TypeScript, we can use the TypeScript compiler to generate type definitions instead of manually maintaining an ambient declaration file. This PR removes our manually maintained
index.d.ts
file and updates thepackage.json
to reference the generated type definitions.Checklist
index.ts
21c806ctypings
field inpackage.json
to reference generated type definitions bab3e96index.d.ts