Repository navigation
Description
🔎 Search Terms
- project references
- tsconfig.json
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about project references.
⏯ Playground Link
No response
💻 Code
Full reduced test case: https://github.com/OliverJAsh/ts-project-references-nested
Contents inlined below.
tsconfig.json:
{
"compilerOptions": {
"outDir": "./dist/"
},
"references": [
{ "path": "./demos/tsconfig.json" },
{ "path": "./app/tsconfig.json" }
]
}
app/tsconfig.json:
{
"compilerOptions": {
"composite": true,
"outDir": "../app-dist/"
},
"include": ["**/*"],
"exclude": ["**/*-demos.*"]
}
app/Component-demos.ts:
// This errors.
import * as helpers from 'demos/helpers';
export const demo = () => {
helpers;
}demos/tsconfig.json:
{
"compilerOptions": {
"composite": true,
"rootDir": "../",
"outDir": "../demos-dist/",
"paths": {
"demos/*": ["./*"]
}
},
"include": [
"**/*",
"../app/**/*-demos.*"
],
"references": [{ "path": "../app/tsconfig.json" }]
}
demos/helpers.ts:
export const foo = 1;🙁 Actual behavior
When I run tsc --build --verbose tsconfig.json, there are no errors, but when I open my editor (VS Code) and open the file app/Component-demos.ts, I see errors:
🙂 Expected behavior
No errors inside my editor.
Additional information about the issue
When app/Component-demos.ts is opened, I believe TypeScript traverses parent file directories searching for a tsconfig.json file, and it stops at the first file it finds which in this case is app/tsconfig.json. This TS project does not include the file app/Component-demos.ts, so I believe TypeScript should continue traversing parent file directories to search for another tsconfig.json that does include the file. In this case, we want TypeScript to discover the root tsconfig.json.
Activity
OliverJAsh commentedon Jul 6, 2024
Sheetal Nandi (@sheetalkamat) I can still reproduce this issue with TypeScript 5.5.3—I've pushed another commit to my reduced test case. Just to check, has this been released?
sheetalkamat commentedon Jul 6, 2024
This fix isn’t in 5.5 but will be in 5.6 .. you can try it out using nightly in the mean time
sheetalkamat commentedon Aug 15, 2024
This will be included in later release after we can improve perf on looking up in referenced projects