-
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
Make typings in package.json an array #6585
Comments
Just curious, what is a scenario when your |
usually exported helper functions and interfaces, that not necessarily is the main code. I keep all my interfaces separated in a file so I can reuse them without having to compile code along with it. like interfaces that are used in frontend files, that can also represent server entities, but I don't want browserify (for example) to bundle my entire server file just to extract some information. |
Declined because we'd rather have a stricter schema. Easy workaround is to replace your multiple array entries with a single file that has |
I feel that I could use typings being an Array too. I have a main module I can't find how to expose both typings without asking my lib users to explicitly link the addon typings in their fileGlob. Declaring the optional module inside the main module's ambiant definition is forbidden, and so is linking it with Any idea on how to do that without a typings Array and with it being fully transparent to the lib users? EDIT: |
A note here is that using /// reference tags gets stripped away when doing typings install :( |
Typescriptlang.org's Typings for NPM Packages page states:
|
Here's an important scenario. It's still very easy to confuse tree shakers with Typescript (calling mixin combiners, static properties, static methods, etc). Anything that resembles a side effect will cause a module to not get dropped from the payload. In a perfect world, the tooling would be able to figure out that these are not external side effects and relate only to the classes within the module. But we don't live there yet, so having a barrel file rexporting everything as an entry point file is currently a liability if you rely on tree shakers being able to limit the scope of what gets bundled I to the app payload. Now, we don't need an entry point file to distribute code in an npm package. Users can import individual modules from the tree of files in a package. But there's all sorts of tooling that can't behave intelligently unless the package.json can hint it at what to look at. But this is all currently geared toward a single entry point. |
Sometimes the main file (like index.d.ts) won't, (and IMHO, should not) reference all the other .ts files from the project. Imagine I have 15+ folders each has a .ts and a .d.ts declaration for it,
index.d.ts
knows nothing about those files, becauseindex.ts
doesn't use them directly.What about if typings could be an array, and you would be able to specify the order of the typings like:
The text was updated successfully, but these errors were encountered: