-
Notifications
You must be signed in to change notification settings - Fork 12.8k
TSServer reports TS6307 in composite projects on JSON files included via include pattern #33827
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
Comments
Looks like https://github.com/microsoft/TypeScript/blob/master/src/services/services.ts#L956 is causing this |
Is this fix live on npm yet? |
I still see a variation of this bug in recent versions. In our case, we have "include": [
"webapp/",
"webapp/**/*.json",
], However, we don't have any uses of .ts files importing .json files, at the moment. Still, tsserver returns lots of TS6307 errors for many different imports of ts/tsx files within the webapp directory. The imported files don't have .json files with the same name. IntelliJ shows lots of imports that say files are not listed within the file list (TS6307) for .ts or .tsx files in webapp/. It looks almost random, and commenting out one import line causes different import lines to show this error. Restarting tsserver does not correct the the problem. Compiling from tsc works with no errors. If you then comment out the pattern I see this with 4.2.3, and also tried with 4.5.5 and the problem remains. |
Due to microsoft/TypeScript#33827 we need to explicitly name JSON files in the "include" array, until we upgrade to a more recent TypeScript. [MAILPOET-5015]
Due to microsoft/TypeScript#33827 we need to explicitly name JSON files in the "include" array, until we upgrade to a more recent TypeScript. [MAILPOET-5015]
Due to microsoft/TypeScript#33827 we need to explicitly name JSON files in the "include" array, until we upgrade to a more recent TypeScript. [MAILPOET-5015]
Due to microsoft/TypeScript#33827 we need to explicitly name JSON files in the "include" array, until we upgrade to a more recent TypeScript. [MAILPOET-5015]
Due to microsoft/TypeScript#33827 we need to explicitly name JSON files in the "include" array, until we upgrade to a more recent TypeScript. [MAILPOET-5015]
Due to microsoft/TypeScript#33827 we need to explicitly name JSON files in the "include" array, until we upgrade to a more recent TypeScript. [MAILPOET-5015]
TypeScript Version: 3.6.3, actually most likely all versions since v3.2
Search Terms: composite, resolveJSONModule, tsserver, TS6307, include pattern
Code
Not particularly easy to show with code, but here's a repro:
https://github.com/lierdakil/ts6307-composite-json-tsserver-test
npm install
node test.js
in a terminaltest.js
(ctrl+C or whathaveyou)Note:
test.js
just spawnstsserver
and tells it to opensrc/test.ts
.Please see README for a complete listing.
Expected behavior:
No error diagnostics.
Actual behavior:
In tsserver output, we see:
{"seq":0,"type":"event","event":"configFileDiag","body":{"triggerFile":"src/test.ts","configFile":"tsconfig.json","diagnostics":[{"text":"File '/tmp/test/src/blabla.json' is not listed within the file list of project 'tsconfig.json'. Projects must list all files or use an 'include' pattern.","code":6307,"category":"error"}]}}
That is, TS6307 on a JSON file, which is included in the project via
include
pattern.Additional observations:
composite: true
.tsserver
, but not intsc
itself.tsconfig.json
usesinclude
, but not when it usesfiles
.Related Issues:
#25636 #30785, also see PR #27844
Other related issues (from external projects):
TypeStrong/ts-loader#905
TypeStrong/atom-typescript#1512
The text was updated successfully, but these errors were encountered: