-
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
Declaration files in parent directories should not be included when excluded #11363
Comments
Also, declaration files under |
I've run into this issue a number of times and I would really like to see a fix for it. Unfortunately there's some argument I believe as to whether or not it's a bug or a feature. |
The reason the exclude doesn't work is because it's designed to work around the problem that while one (usually) does not want to compile TypeScript downloaded as part of external packages, one often wants their definitions, and this is essential for @types. The broader issue is that the language service mimics the node module resolution algorithm. This performs a recursive walk up the directory tree looking for declaration files specifically in folders named This behavior is not amenable to RequireJS and SystemJS loaders and environments. Is also completely unhelpful for those using a package manager other than npm to manage their client sids dependencies. That said, this is not the reason why reason the declarations in your typings folder are not being picked up. You can specify |
If |
I tried
|
i am not sure i understand the question. why including |
Sorry I misunderstood. Yes, |
TypeScript Version: 2.0.3
Directory structure
Expected behavior:
When compiling client project, which is under
public/scripts
directory, only files underpublic/scripts
directory should be compiled and referenced.Actual behavior:
Declaration files in
node_modules/@types
are referenced, causing compilation errors. The project itself is specified to use "amd" module system.Adding following to tsconfig.json doesn't help
Examples of compilation error:
The issue only happens when compiling a project. Compiling files directly works fine, e.g.
tsc -t es5 -m amd --jsx react --sourceMap main.ts
The text was updated successfully, but these errors were encountered: