Description
This issue tracks our plans and discussion around the current situation with package typings.
Internally, we've been talking about how to better package, locate, and discover typings for packages which do not include their own typings.
The issues which arise around packages and their typings include:
- Reuse - the ability to take typings written for long-ago TS (ambient declarations) and continue to use them with little or no modification
- Dependency management - typings typically depend on the same things that their host js packages do - and usually on their typings, not their js.
- De-duplication and flattening - Deeply nested typings (with potentially duplicated dependencies at multiple levels) lead to a lot of duplicated work in the compiler, and could result in longer build times. We'd like to head this off before it becomes an issue in practice if possible.
- Discovery - if I'm using package the node package
bluebird
, how can I find types for it without skipping a beat?
We've spoken with @blakeembrey and his plans for typings
(a tool to replace/improve upon tsd
). We believe that we're both setting out to solve a lot of the same problems, and we'd love to help build much of that functionality into the compiler and language service to create a seamless development experience.
We've come up with a number of improvements to pursue on our end, including:
- Package scopes (Package scopes #4913) to help with typing reuse and isolation issues
- Extending our node module resolution for typings to have a concept of a fallback-typings package - a package which provides typings for a correspondingly named package. (For example,
typed-debug
can be installed and provides types for thedebug
module.) - Reducing the volume of type checking done for packages (ie, don't typecheck them)
We want to make it seamless for users to use typescript with their existing tools and processes, and this includes their dealings with typings. Ideally, we want users to be able to npm install
their dependencies as they already do and have everything "just work" without further steps or instructions.
Tagging @mhegazy @ahejlsberg @vladima @DanielRosenwasser and probably many others who should get tagged for discussion.
I'm sure I've forgetting things from our discussion earlier, so feel free to chime in with the relevant conversion points I've missed.