-
Notifications
You must be signed in to change notification settings - Fork 445
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
VS Code builtin tsserver/TypeScript support picks tsconfig.vitest.json instead of tsconfig.app.json for ts files #159
Comments
For the tsconfig selection, there's an issue in TypeScript repo tracking that: microsoft/TypeScript#48058 As of now, the I'm still not sure what's the best way to type-check the source files when
This looks like a bug to me, needs to be fixed. |
@sodatea Do try my proposed changes, especially in some existing project, let me know if it seems to work better or not. (Not sure if there is a conventional name for the directory used for |
Let me know if you want me to send a PR with any of those changes. |
I don't have the time to try it out now. @xiaoxiangmoe could you help take a look? |
Argh. Just hit this again with it picking up |
@segevfiner Can you provide me a minimal reproduce demo to show the difference? |
Try: https://github.com/segevfiner/create-vue-159. It errors in |
I added your proposed changes to a semi-large project which includes Vitest, Cypress & Storybook. My painpoints:
Because the project is using Vitest, Cypress & Storybook it would be a blessing to get a good solution for this. I might look into this some more, but I'm probably unlikely to succeed. |
Yeah. It's likely not perfect. I wish TS itself would have better handling for this... But the current situation is actively giving me false errors or allowing to use node where I should not, so we should find at least a solution to that... |
I just checked that
It's a bug in Nevertheless, the type-checking experience could be better. I'll look further into it in the coming days. |
TypeScript 5.0 now supports But it also deprecates |
I've tried to wrap my head around these parts for the docs on this that I've written, but I've lost the current status. The project is now using |
In reference to tsconfig.vitest.json, it seems that including |
Follow up to talking to myself in #151 😛
Create a new create-vue project with everything but tsx selected. In this configuration, VS Code's builtin tsserver/TypeScript support seems to pick
tsconfig.vitest.json
, instead oftsconfig.app.json
. It seems the logic to pick them is different between Volar and tsserver, as changing their order intsconfig.json
causes Volar to be the one to selecttsconfig.vitest.json
instead oftsconfig.app.json
.Adding the following to
tsconfig.vitest.json
:Seems to make VS Code select
tsconfig.app.json
for ts files properly, but this is some pure guess work and I'm not sure where or how the logic to select an appropriate tsconfig works.In addition:
vue-tsc --noEmit -p tsconfig.vitest.json --composite false
to type check, but in case the user wants to add additional projects to the project references config, this won't type check them. Apparently--build
,composite
, and project references don't supportnoEmit
, so we need to useemitDeclarationOnly
,declarationDir
instead to make it emit types to some folder solely for the purpose of type checking. On the plus side, in this mode it reuses them when it can for faster type checking (It also enablesincremental
).tsconfig.vitest.json
has"lib": []
, but this should probably be"lib": ["ES2016"]
to matchtsconfig.app.json
just without DOM.So basically the following changes to the generated project seems to fix those things for me:
@sodatea
The text was updated successfully, but these errors were encountered: