ToddThomson / tsproject

Typescript minifier and modular typescript bundle optimizer for gulp (Ts Vinyl Adapter).
Other
57 stars 12 forks source link

Ambient definitions being implicitly picked up from installed npm packages #89

Closed niemyjski closed 8 years ago

niemyjski commented 8 years ago

Does tsproject or typescript is automatically picking up typings that are in npm packages of which I never referenced? I have always referenced exactly what ambient definition files I want to reference and now they seem to be picked up after npm installing a package up date.

https://ci.appveyor.com/project/Exceptionless/exceptionless-javascript/build/1.4.329

niemyjski commented 8 years ago

https://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html

niemyjski commented 8 years ago

If I copy this definition to a local folder and put it in the files section of tsproject and remove the definition from the npm folder everything works. If I do the opposite, and delete all references and local definition and use the one in the node_modules folder I get the following error: https://github.com/csnover/TraceKit/blob/master/tracekit.d.ts

[TsProject] /Users/blake/Code/Exceptionless.JavaScript/src/services/DefaultErrorParser.ts(6,27): error TS2656: Exported external package typings file '/Users/blake/Code/Exceptionless.JavaScript/node_modules/TraceKit/tracekit.d.ts' is not a module. Please contact the package author to update the package definition. [TsProject] src/exceptionless.ts(12,27): error TS2656: Exported external package typings file '/Users/blake/Code/Exceptionless.JavaScript/node_modules/TraceKit/tracekit.d.ts' is not a module. Please contact the package author to update the package definition.

niemyjski commented 8 years ago

Is there a good way to know which definitions will be used?

ToddThomson commented 8 years ago

@niemyjski Take a look at the tsconfig.json setting: moduleResolution .

niemyjski commented 8 years ago

Thanks!