-
Notifications
You must be signed in to change notification settings - Fork 36.8k
Description
- VSCode Version: 1.38.0
- OS Version: 10.14.6
- TypeScript version: tested with both 3.5.2 and 3.6.2
Steps to Reproduce:
./tsconfig-src.json:
{
"compilerOptions": {
"composite": true,
"declarationMap": true,
"outDir": "./target/",
"baseUrl": "./src/"
},
"include": ["./src/**/*"]
}./tsconfig.json:
{
"references": [{ "path": "./tsconfig-src.json" }],
"files": []
}./src/main.ts:
import { foo } from 'helpers/functions';
foo;./src/helpers/functions.ts:
export const foo = 1;When I run tsc --build, it builds with no errors.
When I navigate to a TS file in VS Code, e.g. ./src/main.ts, I get errors: Cannot find module 'helpers/functions'
I expected this to work because VS Code would find the ./tsconfig.json in the parent/root directory, and this references ./tsconfig-src.json (the TS project which includes the file I'm looking at: ./src/main.ts).
Repo including the above test case: https://github.com/OliverJAsh/unsplash-ts-project-references
I understand I could workaround this by moving ./tsconfig-src.json into the ./src/ folder at ./src/tsconfig.json, but I believe that shouldn't be necessary.
What's more, in my real world application the ./tsconfig-src.json includes files in multiple root folders (./src/, ./client/, ./server/), not just ./src/, so this workaround wouldn't help in that case. For an example, see https://github.com/OliverJAsh/unsplash-ts-project-references/tree/bad-workaround.
Does this issue occur when all extensions are disabled?: Yes
Potentially related:
- Allow to specify the tsconfig.json filename explicitly #12463
- Project references are not picked up (1) #80423
- TypeScript: aggregate errors for file from all projects TypeScript#20185
- Find references even when TypeScript sub-projects not yet open TypeScript#30823
- [WIP] Open bigger set of configured projects when opening composite project for operations that operate over multiple projects like rename TypeScript#28261
- For editing experience, use source instead of .d.ts files from project references TypeScript#32028
