-
Notifications
You must be signed in to change notification settings - Fork 538
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 ambient declaration file (index.d.ts) with generated type definitions #1067
Conversation
🦋 Changeset detectedLatest commit: f859862 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/2ATe5Jv9BoJxZyJvXHawaGJP5tYX |
The previous implementation didn't handle the as prop correctly
This branch is stale. Closing in favor of #1147 |
Problem
Primer React components 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 components 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.TODO