-
Notifications
You must be signed in to change notification settings - Fork 12.8k
VSCode TypeScript project references resolve of duplicate files #48058
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I found: |
@RyanCavanaugh @sheetalkamat I found this change after #41126 And volar follows the old behavior. Also some code template, like Angular CLI V10, create-vue depends on the old behavior. Could you please pay attention to this issue? thank you very much. |
4.1 was released a year and a half ago and this is the first complaint we've seen of it. If a file is in multiple projects like this, the one we choose to load it in is arbitrary. We have a suggestion to allow users to pick the active tsconfig file, but without that, there isn't a bug bug here. |
Maybe because it's a subtle problem that many users won't notice? We can work around this issue in the command line.
Why? This makes it impossible to support the following use case:
In this scenario, we need Modules like So to prevent Similar use cases are also very common in server-side-rendered apps with many modules to be used in both the browser and Node.js context. |
To solve the issue, I propose that:
|
I am facing the same issue in an nx monorepo where every app has its own three tsconfigs
this is how the tsconfig.json looks like {
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"strict": true,
"esModuleInterop": true,
"resolveJsonModule": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.spec.json"
}
]
} vscode on the other side does not even pick this one, instead it picks the tsconfig.spec.json. If I remove the reference vscode does not find any tsconfig anymore |
This issue has been marked as 'Not a Defect' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Bug Report
π Search Terms
VSCode, tsconfig ,project references
π Version & Regression Information
β― Example repo
https://github.com/xiaoxiangmoe/typescript-project-reference-demo.git
π» Code
// tsconfig.json
// tsconfig.app.json
// tsconfig.test.json
// src/components/Foo.ts
π Actual behavior
I think
const cwd = process.cwd()
should has an Error.Because file
src/components/Foo.ts
are included intsconfig.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 bothtsconfig.app.json
andtsconfig.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?
The text was updated successfully, but these errors were encountered: