-
Notifications
You must be signed in to change notification settings - Fork 180
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
Do not publish ts sources to npm #440
Comments
you can instead use an alias with your bundler to import from the relevant module. https://webpack.js.org/configuration/resolve/ Typescript also has a safety valve with path mapping: https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping I and a growing community of people really prefer the unmodified source being shipped, particularly if its typescript source code, so we can get all the completions properly (sometimes projects don't generate declarations properly). Also, it allows for more advanced use cases where the developer can compile the source code in an appropriate manner. It also gets around source code not compiled with newer versions of typescript (so they don't include the updated tslib helpers etc). I think this is a much more nuanced discussion, and I think Microsoft should rethink this being the general advice and plan accordingly, in my not so humble opinion. I do think you should ship both targeted source code and unmodified source code though. There is a reason why the |
agree with @ScottAwesome, we use the TS sources... |
It's a much better idea to publish and consume the .d.ts files if what you're after is the typings. You should not try to compile another project's TypeScript source with your project settings as they might not match. I'm getting compiler errors because of this that |
Same as above, using |
In typescript project, it might not be possible to import incremental-dom@0.7.0 with
import
because in this case typescript will try to compile source files from node_modules. But the project may have different compiler options and typescript version and incremental-dom sources will fail to compile. Unfortunately, the only workaround I found is to userequire()
https://github.com/Microsoft/TypeScript/wiki/FAQ#why-is-a-file-in-the-exclude-list-still-picked-up-by-the-compiler
In general, ts code should not be published to npm
microsoft/TypeScript#22228
The text was updated successfully, but these errors were encountered: