Skip to content
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

Closed
wants to merge 20 commits into from

Conversation

colebemis
Copy link
Contributor

@colebemis colebemis commented Feb 22, 2021

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, because index.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 the package.json to reference the generated type definitions.

TODO

  • Test in memex

@changeset-bot
Copy link

changeset-bot bot commented Feb 22, 2021

🦋 Changeset detected

Latest commit: f859862

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/components Major

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

@vercel
Copy link

vercel bot commented Feb 22, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/primer-components/2ATe5Jv9BoJxZyJvXHawaGJP5tYX
✅ Preview: https://primer-components-git-cb-remove-declaration-file-primer.vercel.app

@colebemis colebemis mentioned this pull request Feb 22, 2021
53 tasks
@vercel vercel bot temporarily deployed to Preview February 22, 2021 22:55 Inactive
@vercel vercel bot temporarily deployed to Preview February 23, 2021 00:19 Inactive
@vercel vercel bot temporarily deployed to Preview February 23, 2021 19:57 Inactive
@vercel vercel bot temporarily deployed to Preview February 23, 2021 20:02 Inactive
@colebemis colebemis marked this pull request as ready for review February 23, 2021 22:13
@vercel vercel bot temporarily deployed to Preview February 23, 2021 22:30 Inactive
@colebemis colebemis marked this pull request as draft February 24, 2021 03:31
@colebemis colebemis changed the title Remove ambient declaration file (index.d.ts) Replace ambient declaration file (index.d.ts) with generated type definitions Feb 25, 2021
@vercel vercel bot temporarily deployed to Preview February 25, 2021 18:16 Inactive
The previous implementation didn't handle the as prop correctly
@vercel vercel bot temporarily deployed to Preview February 25, 2021 19:42 Inactive
@vercel vercel bot temporarily deployed to Preview February 25, 2021 19:45 Inactive
@vercel vercel bot temporarily deployed to Preview March 4, 2021 15:37 Inactive
@vercel vercel bot temporarily deployed to Preview March 4, 2021 15:56 Inactive
@vercel vercel bot temporarily deployed to Preview March 8, 2021 18:32 Inactive
@vercel vercel bot temporarily deployed to Preview March 8, 2021 18:44 Inactive
@vercel vercel bot temporarily deployed to Preview March 8, 2021 19:58 Inactive
@vercel vercel bot temporarily deployed to Preview March 8, 2021 20:46 Inactive
@colebemis
Copy link
Contributor Author

This branch is stale. Closing in favor of #1147

@colebemis colebemis closed this Apr 1, 2021
@joshblack joshblack deleted the cb/remove-declaration-file branch January 19, 2023 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant