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

What is this project's relationship to DefinitelyTyped? #41

Closed
tansongyang opened this issue Aug 16, 2017 · 3 comments
Closed

What is this project's relationship to DefinitelyTyped? #41

tansongyang opened this issue Aug 16, 2017 · 3 comments

Comments

@tansongyang
Copy link

I just found out that typings for lodash exist in both this project and on DefinitelyTyped. This brings up a few questions:

  1. Is there any relationship between the two, or are they disjoint efforts?
  2. If they are separate projects, why is that the case?
  3. If they are separate projects, what are the strengths and weaknesses of using one over the other?

I'm asking here because DT has thousands of issues, and I suspect this one will get buried.

@demurgos
Copy link
Member

  1. Both are distinct projects, but typings is now deprecated: the goal is to have a single system (@types backed by DefinitelyTyped)
  2. Typings was created to address some issues of Definitely Typed, mainly that it offered only global definitions (causing conflicts on duplication), there were issues on transitive dependencies and all the definitions were hosted in single repo so it was painful to contribute.
  3. Typings made type management sane. DefinitelyTyped went through a transition and is now mostly OK from a consumer point of view (you can simply install types with @types) but it's still pretty hard to contribute to it. Also, typings tricked the compiler to accept multiple type definitions by smartly creating bundles, on the other hand @types is understood by the compiler using Node's resolution.

If you want a future-proof solution, use @types (types from Definitely Typed). It improved during the previous year and is the officially supported solution.

@tansongyang
Copy link
Author

@demurgos Thanks for that response. I'm closing this issue because you answered my question, but I do have one follow-up question.

Since DT is what is officially supported, would it ever make sense to contribute to this project? Should it be deprecated to avoid confusion?

@demurgos
Copy link
Member

The repositories of the types organization are still maintained to not break the workflow of people relying on typings, and because of the long-awaited Issue 4.

To be precise, I recommended to you to use @types, not DefinitelyTyped directly: instead of downloading types from Github, use the ones published on npm. There is a level of indirection: you are not tied to DefinitelyTyped or the types Github organization. Even if only DefinitelyTyped is used at the moment, there is some effort to use the individual repositories of the types Github organization instead (at least partially). This would allow individual issue trackers, PRs, CI, etc.

If your projects needs type-definitions for a library and you don't want to wait for others to fix your problem, I'd recommend the following workflow:

  • Write type definitions in your own project (I usually use a directory called custom-typings and set it as a type root). Once it works in your project, share it:
  • Open an issue / PR on the repo of the library: ask them to host their own type definitions. This is the best case scenario and some libraries are happy to do it. (It allows to simply npm install my-lib and have both the types and implementation)
  • Otherwise, focus on DefinitelyTyped to get your change on @types as soon as possible. You can open a PR on the corresponding types repo, but until the issue 4 is solved, you won't have any direct benefit out of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants