Closed as not planned
Description
Bug Report
π Search Terms
VSCode, tsconfig ,project references
π Version & Regression Information
- TypeScript Version: 4.1.0-dev.20201020 (4.1.0-dev.20201019 works well)
- VS Code Version: 1.64.2 (Universal)
- OS Version: Darwin x64 21.2.0
β― Example repo
https://github.com/xiaoxiangmoe/typescript-project-reference-demo.git
π» Code
// tsconfig.json
{
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.test.json"
},
]
}
// tsconfig.app.json
{
"include": ["src/**/*"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"moduleResolution": "Node",
"composite": true,
"target": "ESNext",
"noEmit": true,
"strict": true,
"lib": ["DOM", "ESNext"],
"types": []
}
}
// tsconfig.test.json
{
"extends": "./tsconfig.app.json",
"exclude": [],
"compilerOptions": {
"types": ["node"]
}
}
// src/components/Foo.ts
export type FooProps = { a: number };
export function Foo(props: FooProps) {
return null;
}
/**
* this file is included in both `tsconfig.app.json` and `tsconfig.test.json`
*
* So we should follow the order of `references` in `tsconfig.json`
*
* `tsconfig.app.json` comes before `tsconfig.test.json`, so we should use config file `tsconfig.app.json` in vscode
*
*/
const cwd = process.cwd()
π Actual behavior
I think const cwd = process.cwd()
should has an Error.
Because file src/components/Foo.ts
are included in tsconfig.app.json
. So it has not include type @types/node
.
π Expected behavior
const cwd = process.cwd()
has no Error.
File src/components/Foo.ts
is included in both tsconfig.app.json
and tsconfig.test.json
. VSCode search references field and use the last item of references ββ tsconfig.test.json
. So it has no error.
I think we should use first reference. I remember that earlier versions of vscode did this too. I want to know why VSCode/TS change it to use last reference?