-
Notifications
You must be signed in to change notification settings - Fork 440
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
Document tsconfig.*.json
#265
Comments
Also, why does type-check use the vitest tsconfig? I'd expect it to use the app tsconfig. |
Because the vitest tsconfig covers both the app modules and the test spec modules, therefore more comprehensive than the app tsconfig. But never mind, after #274 we'll be using |
Got it, thanks @sodatea. I did try that out and ran into an issue, which I've flagged on the PR. Still, good to understand the current setup. To throw in a tsconfig that threw me off more than others: the cypress one that's under cypress/e2e. I generated a scaffold and copied over the tsconfig files in the root dir to my actual project, but missed that one until just now. I only knew it existed because I was browsing around templates. |
Okay, me again, back again. Really really struggling here, again, as I do every time I try to touch this. Please pardon some frustration here, I've been fighting with this all day. At this time, I'm pretty sure there's an actual bug in the resulting create-vue template, but have no way of even trying to understand the intent to confirm that. I can't even test different scenarios: I don't know what scenarios to test. I see something that somehow Volar is supposed to auto-select certain tsconfigs in some situations? How? What do I test? What about vue-tsc? How do all those pieces fit together? I'm trying to follow the intent with the tsconfig.app.json and vitest and so forth and I'm just very lost. I put some of my confusion down here but honestly that's just the start. Do I need to configure tsserver or Volar somehow? If I need to add new types or libs, how do I do that? Do I need to set it in the app one and also in vitest? These questions are just the start. It feels like every time I try to fix something in this set of configs, I break something else, and then only find out ages later. The biggest issue is that all of these thing have really large invisible footguns. tsconfig values get overwritten, and also it seems some of them are loaded by specific tools somehow, so it's easy to e.g. add one lib in one place and then suddenly you've broken type checking, but only for volar and for some editors, not when you run vue-tsc. Or several variations of that. I'm also pretty sure there's at least one bug in the default configuration, as included in the link. But without being a tsconfig expert, I have no way of knowing if I'm just misunderstanding something, or misusing something, or what. I've fixed the "lib is overwritten" issue by putting the app tsconfig last, like #264 suggests. Does that break something? What? Is there something I need to test? That suggests I need to set reverseConfigFilePriority -- is that still a thing? Where? Do all devs need to set it? How? I'm very frustrated and overwhelmed with all of it, TBH. I've tried my best to read about it but the discussion I can find talks about multiple options that have changed, none of which I understand. It seems like, to even try to add a single new "type" into my typescript project, I have to dig through all the history, multiple obscure tsconfig options, wrap my head around their interactions with Volar and vue-tsc, and more. |
Key questions I need to understand:
|
Hi @bmulholland Maybe you can add a few Stackblitz using https://stackblitz.com/github/vuejs/create-vue-templates/tree/main/typescript-vitest?file=src%2Fcomponents%2F__tests__%2FHelloWorld.spec.ts with your use-cases so we can take a look? It's hard to answer without specific examples. I'm not sure we'll be able to help with everything, but it's worth a try to see if someone in the community has the same issue. And we may be able to open specific issues on different repositories (create-vue may not be the right place for some things that I suspect are vue-tsc issues for example). |
@cexbrayat Thanks for the offer! I'll do you one better: here's the documentation I wish I had, based on what I've been able to figure out. Hopefully someone (you?) can fact check & help with areas I'm unclear, and then we'll have the docs and can close out the issue :) References I used:
create-vue tsconfig setupcreate-vue sets up TypeScript using multiple tsconfig files. Here’s an overview of how these configurations work together: Type checkingType checking is done using
Since the build option is used, TS build info files are emitted. Each tsconfig sets their own output directory, within tsconfig filesPrimary Configuration (
|
@bmulholland Looks good! Thanks for taking the time to write this. I would also mention the Anyway, this should probably be in the official vue.js docs; Would you mind opening a PR there to see if the docs team finds it interesting? |
Awesome :)
Yeah good idea, will add.
|
Thanks for writing this up! It looks good. Regarding the confusing setup of |
In lack of a better issue and since it is already discussed here:
As the Two solutions. You could either defined the same Maybe that is worth considering in this scenario. |
ref vuejs/tsconfig#16
thanks @sodatea
The text was updated successfully, but these errors were encountered: