typings / discussions

For discussions and issues with Typings or TypeScript definitions
7 stars 0 forks source link

Integration with typescript compiler's typing discovery and location plan #3

Open weswigham opened 8 years ago

weswigham commented 8 years ago

This issue is to support/mirror discussion on #5537 but from the typings side.

While we've not yet nailed down a plan on what out endgame is in the compiler, one thing I know I'd certainly love to see typings do really well is discovery for a package's type information. We want to see users go from npm install bluebird --save to actually having the third-party types for that package (of the correct version!) available for them to depend on and use in editor and compilation experiences as seamlessly as possible.

@blakeembrey mentioned a resource for typings to use to automate discovery of typings, and potentially browse-able by humans. This would be excellent - potentially being able to locate the corresponding types for a series of package.json entries is a big step towards making finding existing types as seamless as possible. We'd love to know how your design and implementation with this proceed.

Pinging @mhegazy @ahejlsberg @vladima @DanielRosenwasser for their thoughts.

jasonswearingen commented 8 years ago

sorry for the novice post, but what is this typings project? a cursory web search gleams nothing relevant.

blakeembrey commented 8 years ago

@jasonswearingen A blog post and introduction will be coming in a few weeks, promise! Basically, it's an attempt to make typings just work. There's a CLI tool available at https://github.com/typings/cli which is working pretty smoothly (some minor issues, especially around UX), but a tighter integration with the compiler is planned to avoid duplication of information.

blakeembrey commented 8 years ago

@weswigham I just completed a working implementation with https://github.com/typings/registry and https://github.com/typings/cli. The registry is a little sparse now, but works pretty fantastic.

blakeembrey commented 8 years ago

@weswigham Is there a way to reuse something like https://github.com/Microsoft/TypeScript/pull/4913 and generate an output that could be used for the package.json typings reference? That way, it's almost all the same benefits and the end user doesn't need to know the author is using typings. If possible too, maybe having a special syntax to denote that this is a resolved lookup using a specific supported resolution in TypeScript - E.g. @filename: ~node_modules/a/index.d.ts (note the tilde). That would be used by the TypeScript symbol to merge duplicate symbols at compile time when the files are compatible.

blakeembrey commented 8 years ago

@weswigham Just an update, over the weekend I published the registry API available here: http://api.typings.org/search. To see versions, use http://api.typings.org/versions/dt/react. To narrow it down you can use http://api.typings.org/versions/dt/react/%3E=0.14. There'll be a front-end for this soon to introduce typings and TypeScript, but the API was more important personally since all the tooling needs to rely on this. I integrated it into the CLI yesterday (it'll search and prompt the user right now, can narrow down preferred behaviour later). If the TypeScript team wants to use this API for something, please ping me for anything needs to be added or changed.