-
Notifications
You must be signed in to change notification settings - Fork 11
.d.ts typings #3
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
base: master
Are you sure you want to change the base?
Conversation
Thanks for the contribution @downace. There's a big risk that these will not be kept in sync with the code-base. How do projects that isn't developed in TypeScript normally ensure this doesn't happen? |
It should be done manually by contributors of the project when major/minor version releases (according to semver - interface is not changing on patch release). Or by somebody else who uses this package in TypeScript code (like me) using PRs. I think there is no more reliable way There is an alternative: I can PR this typings to the DefinitelyTyped repository. Of course, desync is possible too, but you can not worry about it because there is huge community that will do all the job for you (I think 😄) |
This is indeed an interesting discussion. What I have seen as a typical solution is:
I would argue that typings on DT are actively maintained. The bigger the community for the project, the bigger the chance someone will use TypeScript, the better the maintenance for the typings. |
Is there some easy test that can be run to ensure the |
@pmuellr That would be a good question to ask to DefinitelyTyped or TypeScript community. The feature would be very helpful.
Btw, we'd recent discussion about the same topic at fastify/fastify/issues/649 |
DT has some rad tooling to automatically ping former contributors to code review new PRs and automatically merge-and-push to npm. If your project is comfortable committing to update your d.ts file when your public API changes, including the d.ts file in your npm module is convenient. If not, DT is a really good alternative. It's only slightly more inconvenient because dependents need to know to |
Thanks @appsforartists for the information That way the maintainers of the JavaScript projects can put their time/efforts in making their package better, while TypeScript maintainers can just worry about updating the type definitions when main package has major updates. |
To be clear, those notifications are for changes to DT. So, if However, if someone opens a PR on DT for |
The advantage of DT is more ready access to a community of TypeScript developers who don’t use your package, but who might plausibly help fix your typings. The disadvantage of DT is that it’s a terrible way of relating to TypeScript developers who do use your package. You ship API changes, and your users don’t get them until one goes to the effort of filing a PR. You don't ship API changes, but your users' builds break because someone decided to rename an interface because they prefer or don’t prefer a leading DT is better than nothing, but you can do a lot better than DT. Add a |
Added TypeScript typings