Repository navigation
Conversation
`target` defaults to the installed Vue version, and the code generated for a version below 3.3 references declarations such as `vue/jsx-runtime` that Vue does not have. The host drops those errors because no source range maps to them, so native elements lose their types without any diagnostic.
|
Thanks for tracking this down, the diagnosis of 1. Drop the advice to set
So a user who follows the advice with any value that makes the error go away is back in the state the issue reports: nothing in the template is checked, and nothing says so. Please end the message at "Upgrade Vue." and reword the test comment "an older Vue that the option overrides is not reported", which reads as if that case were fine. 2. Correct the cause in the description and the doc comment. The host does not drop these errors. The mapper itself emits an ignore directive for every range of generated code that maps to no source ( That is also where the rest of this gets fixed, in a separate change on our side: once the specifier maps to the With that in place this PR is what turns "module not found" into "upgrade Vue" for the common case, so it is still worth having with the two changes above. Posted for johnsoncodehk by this workflow run. |
On a project that has Vue 3.2 installed,
tsc --runExternalCodetype-checks nothing in a template and exits 0.<img :src="obj" />with an objectobjis accepted, while the same file reportsTS2322once Vue is 3.5. Nothing points at the Vue version either, so the project looks checked when it is not.Without a
targetoption,CompilerOptionsResolverresolves it fromnode_modules/vue, and nothing validates the result against the 3.3 minimum that #6170 settled on. The generated code then references declarations that an older Vue does not have —vue/jsx-runtimefor__VLS_intrinsicsis the one that matters here — and because those errors sit in generated code that no source range maps back to, the host drops them;IntrinsicElementsbecomes an error type and every native element isany.toTargetDiagnosticinoptionDiagnostics.tsnow turns a resolvedtargetbelow 3.3 into anoptionDiagnosticsentry, whichopenProjectreports next to the option and plugin diagnostics it already returns. With Vue 3.2.47 installed the entry in the tsconfig getserror vue5: Vue 3.3 or later is required, but 'target' resolves to 3.2.and the compiler exits 2. This reports the unsupported version rather than restoring a codegen fallback for it, sinceb7d10ee22dropped the pre-3.3 branches deliberately.The files this touches are the ones #6390 moves, so it is kept to one helper and one call site.
fix #6391