Skip to content

TSServer reports TS6307 in composite projects on JSON files included via include pattern #33827

Closed
@lierdakil

Description

@lierdakil

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):
TypeStrong/ts-loader#905
TypeStrong/atom-typescript#1512

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions