5 ms·
Are the HTML templates type checked as well? I'm playing with Vue version 3 with TypeScript using JSX instead of the usual HTML templates and pretty happy tha
by seanwilson 6y ago
Are the HTML templates type checked as well?
I'm playing with Vue version 3 with TypeScript using JSX instead of the usual HTML templates and pretty happy that it's all type checked. I have a similar project without JSX and the vast majority of the bugs are related to the logic in the HTML templates not being type checked.
- dlbucci 6y agoThis has been my experience with AngularJS 1 and TypeScript as well. Looks like there's at least some support for it (Quote the link: You get autocompletion hints and type-checking as you're writing components, even in expressions inside markup). Not sure if it does things like restrict `value` to `input` elements or anything, or if it's just the expressions in the template.
- smt88 6y agoTry using Vue in WebStorm with their Vue plugin enabled, or use TSX with any IDE. Your "HTML" will be type-checked.
- joshstrange 6y agoHmm, I'm going to have to take another look at this then because I get auto-complete of variable properties in my html (IDEA + Vue plugin) but I don't get warnings about a variable possibly being null or undefined. But that may be outside the realm of possibility to check easily.
- smt88 6y ago> But that may be outside the realm of possibility to check easily. It depends. If you type-check your runtime input (e.g. form fields) then it works well.
- raihansaputra 6y agoVue with TS, on VSCode and Vetur, with Vetur Template Interpolation enabled (VTI) also typechecks the template.
- swyx 6y agoyes - tho coverage isn't 100% perfect. still need help to cover some things, this is a very large surface area to cover https://github.com/sveltejs/language-tools/issues/ https://github.com/sveltejs/language-tools/issues/