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

Add TypeScript typings #1

Closed
wants to merge 3 commits into from

Conversation

@squidfunk
Copy link

commented Oct 1, 2019

This PR adds TypeScript typings.

squidfunk added 3 commits Oct 1, 2019
@squidfunk

This comment has been minimized.

Copy link
Author

commented Oct 1, 2019

The npm package did not include the typings, as the package.json only defined a files array. I pointed main to index.js and added index.d.ts to files which fixes the issue.

@wooorm

This comment has been minimized.

Copy link
Owner

commented Oct 1, 2019

Thanks for taking the initiative to work on this!

TypeScript recommends types for non-TS packages to be published from DefinitelyTyped.

What is the reason for going against their advice?

@squidfunk

This comment has been minimized.

Copy link
Author

commented Oct 1, 2019

Honestly, I object this, as separating typings from their source may induce lag and drift. Many typings that are on DefinitelyTyped, especially those for lesser-known, smaller libraries are old and incorrect as they are not updated. From my experience, placing the typings next to the source yields more up-to-date typings and greatly improves the ease of maintenance.

I, myself, have a library for which someone wrote DefinitelyTyped typings and those typings are outdated and wrong. This recommendation feels dated and probably comes from a time where there weren't many typings and the TypeScript team wanted everyone to benefit.

@wooorm

This comment has been minimized.

Copy link
Owner

commented Oct 1, 2019

Honestly, I object this, as separating typings from their source may induce lag and drift. Many typings that are on DefinitelyTyped, especially those for lesser-known, smaller libraries are old and incorrect as they are not updated. From my experience, placing the typings next to the source yields more up-to-date typings and greatly improves the ease of maintenance.

Yes, that is a downside, but I don’t use typescript. And people contributing here may not either. Meaning that the types here will also lag and drift apart.

I, myself, have a library for which someone wrote DefinitelyTyped typings and those typings are outdated and wrong.

It’s open source! Anyone can contribute to DT!

This recommendation feels dated and probably comes from a time where there weren't many typings and the TypeScript team wanted everyone to benefit.

I cannot speak to their opinions. But I did “survive the coffeescript era”, which was similar: maintainers got pull requests rewriting their projects into CS or did it themselves, and a couple years later, everyone reverted again.
The projects I maintain, although this one is really new, have been around since I started OSS 6 years ago, and will be around for the next 6 as well.
If you’d like to sign up to maintain the TS definitions here for say, the foreseeable future of a couple of years, I’m fine adding them here, and I’ll give you write permissions!

@squidfunk

This comment has been minimized.

Copy link
Author

commented Oct 1, 2019

If you’d like to sign up to maintain the TS definitions here for say, the foreseeable future of a couple of years, I’m fine adding them here, and I’ll give you write permissions!

I would regard the API of this project (for which the typings are for) as rather stable, as the project implements an RFC spec and does not provide a super-hipster frontend framework. However, if you feel that it's not a good fit, feel free to close this PR. I will then just add the typings locally to my project, as I have a single location where I use your library (kudos for that btw.).

I have no intention to become a maintainer of this project or contribute to DefinitelyTyped, as the latter repository is absolutely unusable because of its sheer size. I just wanted to "give something back".

@wooorm

This comment has been minimized.

Copy link
Owner

commented Oct 3, 2019

Alright! I really appreciate that you want to contribute and help, but I’d rather not accept this change though, as outlined above. I think definitely typed is the place for it, and hope that you’d reconsider (or maybe raise the question whether the DT advise is still current with TS folks?)

Thanks and best!

@wooorm wooorm closed this Oct 3, 2019
@squidfunk

This comment has been minimized.

Copy link
Author

commented Oct 3, 2019

Funny, that you accept typings to be included in the repository for unified, but not for this one. But hey, nevermind.

@wooorm

This comment has been minimized.

Copy link
Owner

commented Oct 3, 2019

The reason for that is that a community maintains the unified collective. Several of the people there maintain the types. Although I created unified, and am a core maintainer, I am not the only voice there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.