Skip to content

tsconfig.vite.ts should include only the test files #151

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

Closed
wants to merge 1 commit into from

Conversation

segevfiner
Copy link

Otherwise node and jsdom types are available in ts and vue files. Whoops.

Otherwise node and jsdom types are available in ts and vue files. Whoops.
@segevfiner
Copy link
Author

segevfiner commented Sep 1, 2022

Oh wait. This will cause the default type-check command to only check the types of the test files. We will have to modify that as well. But I'm not sure how. As they don't support tsc --build --noEmit.

@segevfiner segevfiner marked this pull request as draft September 1, 2022 13:37
@segevfiner
Copy link
Author

segevfiner commented Sep 4, 2022

Argh. There is a bit of a problem here. Type checking with just using tsconfig.vite.json won't work as the test files include the app's code, & tsc/vue-tsc --build --noEmit is not supported, as that mode relies on .d.ts output files to compile each project separately and type check them agains't each other. This might mean we will need to not use noEmit and use declarationDir/outDir/emitDeclarationOnly to some dedicated directory to run type checking.

Opinions anyone? @sodatea @cexbrayat

@segevfiner
Copy link
Author

I tried swapping the order of tsconfig.app.json & tsconfig.vitest.json in tsconfig.json and VS Code decided to use tsconfig.app.json instead. 🤷‍♂️ I still wonder if that's a proper fix or if there is a way to do this properly. e.g. Some variant of tsc --build that does work for only type checking maybe by emitting temporary .d.ts file to some .gitignored folder.

@segevfiner
Copy link
Author

Oh great. The resolution order is flipped between Volar and the builtin tsserver. Volar will prefer the first matching tsconfig, and tsserver the last!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant