-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Better default experience when using a tsconfig file with no "files" property. #3289
Comments
We have talked about defaults as part of the "exclude" support; it was not clear what are the rules that qualifies something to be in the default excludes, e.g. node has node_modules, bower has bower_components, then there are editor specific .vs, .settings, .config...etc.. the other issue is it can be confusing to debug why a folder is excluded while others are not, if there are implicit defaults. Having said that, i would be curious what others think about it as well. |
I understand and agree. Excluding all of node_modules by default might be a bit broad, and I wasn't suggesting that. I was only suggesting that TypeScript lib files be excluded by default for 2 reasons:
|
sorry miss understood the intent. The problem with library files is how do you know them.. the name is not sufficient. There are two ways you can specify a lib file, one is --noLib and include the lib file, the second is you add a comment to the top of the file in your case, would not specifying |
I realize support for globs isn't there, but assuming it was for a moment, something like
Yes, but I don't think that's going to happen by default, right? I'm trying to come up with a solution that's narrow enough that it could be enabled by default. |
I added some simple repro steps to the OP, just for reference. |
👍 |
@vvakame, we are working on the glob support. i am not sure i see how lib.es6.d.ts is related to this discussion. |
This is addressed with #3188. closing. |
FWIW, #3188 does not fix this. For instance, you can still run the repro steps using the latest nightly. This issue wasn't about having the ability to exclude stuff, it was about having a very narrow set of files automatically excluded by default. That said, I could understand a WONTFIX resolution. |
Re-opening for a little more discussion given the latest clarification. I think this falls into some broader issues around managing dependencies, especially duplicated ones. The new 'tsc init' command is another way we could alter the default experience for people if there's a reasonable thing to do there. |
We talked about adding implicit exclude values in the past. The idea of an exclusion policy that is opaque to the user was not appealing. moreover, what should be in it, is it as @danquirk mentioned, |
When using a tsconfig file with no
files
property all declaration files under node_modules are currently pulled in. This is especially problematic if typescript itself resides under node_modules since you wind up with duplicate identifiers fromlib.core.d.ts
andlib.core.es6.d.ts
, etc. I realize this is partially taken care of with #3043 and #3188 but I'm wondering if there should be a special default case of excluding typescript declaration files. Plugins for JS toolchains like gulp-typescript and ts-loader pull in typescript locally so this becomes an issue there.Edit: Repro steps for TS 1.5 beta
mkdir test
cd test
npm install typescript
(install locally, not globally)touch tsconfig.json
./node_modules/typescript/bin/tsc
The text was updated successfully, but these errors were encountered: