-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Recommendation: Simplify NPM/Node code sharing #2829
Comments
typescript:definition
a part of the external module resolutiontypescript:definition
a part of the tsconfig.json files
implicitly
typescript:definition
a part of the tsconfig.json files
implicitly
👍 |
I certainly like If you're not afraid to I'm sure you know that already, but it may help others coming here. However, I fear that going the |
The proposal we have is to use |
Agreed 🌹 |
Thanks 🙇 |
Use the new name. Its clear that its a different feature then and we can phase out what I did previously 👍 |
Proposal
Support
typescript.definition
in package.json of node packages as a part of module resolution.Example
Consider this simple NPM package : https://www.npmjs.com/package/example-typescript-a (src: https://github.com/TypeStrong/atom-typescript-examples/tree/master/node/node_modules/example-typescript-a)
It is super simple to use from atom-typescript. Open any typescript file in atom-typescript, if you have done
npm install example-typescript-a
then you can just use it without any additional configuration: E.g.sample usage
How it works
This is because
example-typescript-a
specifies a location of a definition usingtypescript.definition
:And we look at
node_modules
up its directory and readpackage.json
fortypescript.definition
, for each such module we implicitly include thisdefinition
file as a part of the current project.Creating such a module
Creating such a module
example-typescript-a
is also super easy. All you need to do is a package.json like you would with any NPM package (we care aboutname
,typescript.definition
and optionallymain
) and tell us that you plan to use thispackage.json
from tsconfig. Docs : https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md#packageBased on this we can create the correct
typescript.definition
file for you on buildf6
:.d.ts
createdFuture
If such a module depends on
tsd
definitions OR other projects that have their owntypescript.definition
we need a resolution algorithm for that something like take latest and ignore all others. Plan:d.ts
not giving TypeScript the externalreference
comments (e.g. node.d.ts here https://github.com/TypeStrong/atom-typescript-examples/blob/master/node/node_modules/example-typescript-b/definition/sample-b.d.ts) And instead pointing to our own.d.ts
if we have it in our Typings./cc @csnover
The text was updated successfully, but these errors were encountered: