-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Consider adding a compiler option to not automatically build the inferred type names #10199
Comments
The root cause is that
This isn't really a coherent description of what's going on. If you don't want the |
Hmm,
Now, TypeScript helpfully (I mean it!) gathers all available |
It sounds like you need to split your project into two compilations depending on which environment it's targeting. It can't be the case that two different things are setting up different globals named |
You are right, that's why I'm asking for a way to tell TypeScript not to do it :) Because right now, the default handling of But you are right. It's probably the easiest to make a hard cut between these two worlds. |
…lding the .ts files (microsoft/TypeScript#10199).
I also met this problem when using
I tried setting |
Do you have |
Yes: "typeRoots": [
"typings/globals",
"typings/modules"
] |
can you share a project or a sample? |
Yeah, if you take a look here: https://github.com/types/npm-sequelize/tree/537400ae7cc7d98ccde80f6de35dcabba3963100 Those are typings for Sequelize I (as a maintainer of the Sequelize library) have been maintaining for the typings definition manager. I got countless requests to make them usable with npm / |
The workaround I do is installing dependencies with |
add: "baseUrl": ".",
"paths": {
"*": ["typings/modules/*"]
} to your tsconfig.json |
@mhegazy that works, thanks a lot! |
Some due explanation. there are two concepts at play here. global dependencies, and modules. |
TypeScript Version: 2.0.0
I have a project with several environments where js runs and in these environments, different versions of a global
require
function exist:Code
When I run
node_modules\.bin\tsc test.ts
, I getand with
--traceResolution
I can see these errors originate from building the internal__inferred type names__.ts
.I can fix the error by specifying any explicit
--types
option (but it needs a valid argument), but AFAICS I cannot explicitly turn off building the inferred types. Might be useful.The text was updated successfully, but these errors were encountered: