-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Typescript@next and npm linked node_modules #11916
Comments
@cortopy cab you share a sample, or a repro steps? |
These steps would reproduce the error:
I'm not sure if this is about the lodash types only, but having read the issue that was closed, I suspect it's not just about lodash. |
@mhegazy You will replicate the problem, if you folow the Development environment (linked module) steps this repository https://github.com/linck/protontype-example. |
Does anyone know of any workarounds to this that exist at the moment? |
@aboveyou00 I am using typings in linked module to test in development environment. Or delete @types folder of linked module. Or I just ignore |
thanks @linck. this is was very useful. I understand the problem now. the issue is that there are really multiple packages on disk that are being loaded. so for lodash for instance there is:
which is correct since there are two node packages for lodash loaded as well at:
The source of the issue is that the declaration file for lodash is not authored correctly. it is authored as a global file, where two instances of the package can not co-exist. the correct fix here should be done on the lodash side in https://github.com/DefinitelyTyped/DefinitelyTyped/blob/types-2.0/lodash/index.d.ts You can workaround this issue by setting a path mapping into your tscofig.json as such: "compilerOptions" {
....
"baseUrl": "./",
"paths": {
"*": [ "node_modules/@types/*", "*"]
}
...
} What this does, is it tells the compiler, when resolving a module for instance |
Thanks very much @mhegazy! This config really solve the problem. |
* Fix microsoft/TypeScript#11916: Make lodash declarations a module * Use lodash as a module * Use lodash as module * Add headder
lodash should be fixed by DefinitelyTyped/DefinitelyTyped#12361, we need to do the same to express and express-server-static as well. |
* Switch express-serve-static-core to a module * Add tsconfig to aws-serverless-express * Switch aws-serverless-express to module * Fix dangling pointer * Fix wrong file name * Add tsconfig.json * switch seamless-immutable a module * Add tsconfig.json * use --strictNullChecks
just to be clear, as described above this is not an issue with any specific type definition. Any type definition that occurs in "types" in .tsconfig both in the main module and the module it |
Looks like a duplicate of #6496. |
I'm experiencing same problem as #9566 and per the last suggestion there, I'm reopening it with this new issue.
My problem has to do with how typescript manages ambient defs in a npm package I use using
npm link
.I get a lot of compilation errors for @types definitions:
Duplicate identifier 'export='.
These errors disappear altogether if instead of linking the module, I install it.
TypeScript Versions:
2.1.0-dev.20161028
2.0.6
Expected behavior:
Typescript doesn't import ambient definitions from linked modules. There shouldn't be a difference in behaviour between linked and installed packages.
Actual behavior:
Linked packages have @types included
The text was updated successfully, but these errors were encountered: