Skip to content

Consider publishing lib files through @types on npm #9851

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

Closed
DanielRosenwasser opened this issue Jul 21, 2016 · 3 comments
Closed

Consider publishing lib files through @types on npm #9851

DanielRosenwasser opened this issue Jul 21, 2016 · 3 comments
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript In Discussion Not yet reached consensus Suggestion An idea for TypeScript @types Relates to working with .d.ts files (declaration/definition files) from DefinitelyTyped

Comments

@DanielRosenwasser
Copy link
Member

Given that being able to snap onto a certain version of the library has various benefits for users, using @types to publish versions of our library to npm is something we should do in the near future.

@DanielRosenwasser DanielRosenwasser added Suggestion An idea for TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript @types Relates to working with .d.ts files (declaration/definition files) from DefinitelyTyped labels Jul 21, 2016
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 2.1 milestone Jul 21, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Jul 21, 2016

So what is the interaction between this an the --lib flag. specifically, what happens if i include lib.es2015.promise.d.ts using --lib es2015.promise and through a package that depends on @types\es2015.promise ?

@alexeagle
Copy link
Contributor

When I originally suggested this, I hoped that these libraries would be distributed on npm instead of in the TS distribution. This is probably impractical because most compilations want a default lib, without making an extra network access to fetch standard libs.

So I propose that --lib es2015.promise first attempts to resolve from @types/es2015.promise, then typescript/lib/lib.es2015.promise. Use the existing distribution as a special-case backup strategy in case the types aren't installed from npm.

The only surprising corner is that if you start with a --lib setting, then npm install some dependency that has a transitive dep on a different version of es2015.promise than you started from, then you observe a change in type-checking promise usage. But doing the same thing today might introduce conflicting definitions, where a library depends on es6-promise from DT and it differs from TS (this has happened a few times).

@mhegazy mhegazy added the In Discussion Not yet reached consensus label Sep 21, 2016
@RyanCavanaugh
Copy link
Member

Declining due to lack of interest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript In Discussion Not yet reached consensus Suggestion An idea for TypeScript @types Relates to working with .d.ts files (declaration/definition files) from DefinitelyTyped
Projects
None yet
Development

No branches or pull requests

4 participants