Typescript: TSServer reports TS6307 in composite projects on JSON files included via include pattern

Created on 5 Oct 2019  路  2Comments  路  Source: microsoft/TypeScript

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

  1. Clone
  2. Run npm install
  3. Run node test.js in a terminal
  4. Observe output
  5. Kill test.js (ctrl+C or whathaveyou)

Note: test.js just spawns tsserver and tells it to open src/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:

  • Issue only manifests when composite: true.
  • Issue only manifests in tsserver, but not in tsc itself.
  • Issue only manifests when tsconfig.json uses include, but not when it uses files.

Related Issues:

25636 #30785, also see PR #27844

Other related issues (from external projects):
https://github.com/TypeStrong/ts-loader/issues/905
https://github.com/TypeStrong/atom-typescript/issues/1512

Bug Fix Available

Most helpful comment

Is this fix live on npm yet?

All 2 comments

Is this fix live on npm yet?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

siddjain picture siddjain  路  3Comments

Zlatkovsky picture Zlatkovsky  路  3Comments

DanielRosenwasser picture DanielRosenwasser  路  3Comments

MartynasZilinskas picture MartynasZilinskas  路  3Comments

bgrieder picture bgrieder  路  3Comments