News for hackers. Stuff that matters.
Re:Vue in 2016 by seanwilson on Wednesday December 28, 2016 @04:09PM (#13273675)
How much type safety do you get using Vue with TypeScript compared to Angular 2 or React? For example, if you use a variable with the wrong name or wrong type in a template, can you set Vue up to give you a compile time error?
Re:Vue in 2016 by alevans4 on Wednesday December 28, 2016 @04:35PM (#13273879)
There is no way to get typing in the template currently that I am aware of. There are various libraries that help with Typescript integration like https://github.com/itsFrank/vue-typescript, but you cannot currently write Typescript as the language in a single page component (again that I am aware of). I'm definitely hoping this is coming this year.
Re:Vue in 2016 by nmerouze on Wednesday December 28, 2016 @06:54PM (#13274710)
You can use JSX instead of string templates. This way you can get type safety.
Re:Vue in 2016 by seanwilson on Wednesday December 28, 2016 @07:58PM (#13274975)
Do you know of any examples of this?
Re:Vue in 2016 by nmerouze on Thursday December 29, 2016 @08:37AM (#13277158)
JSX is in the docs: https://vuejs.org/v2/guide/render-function.html#JSX

I don't have any concrete example of Vue.js + JSX + TypeScript but I know it's a bit tricky, see this thread: https://forum.vuejs.org/t/vue-2-0-and-tsx/308/8