Hacker News new | ask | show | jobs
by jwdunne 2824 days ago
Yeah this is great. Last time I tried, Vue itself wasn't too bad to get going with TS. The real issue for us was Vuex. The official examples and the Typescript examples we found looked completely different. It wasn't easy to get started.

We actually moved to React + Redux since it was early enough in the project to make that decision. Typescript support is much better there. If typescript support was better in Vue/Vuex, I doubt we'd have made that decision.

1 comments

> Vue itself wasn't too bad to get going with TS

Last time I tried, there wasn't any support for type check across component boundaries (props, events). Did something change?

A deal-breaker for me. I mostly know types from within the component; if you keep them small enough it's not much of an issue to just look up/down to check for a name, for example. But cross-component communication is where I need TS the most. Hopefully 3.0 addresses that (didn't read the whole article thoroughly, maybe it's mentioned).

Oh wow. We didn't get far enough to notice that was a problem. We needed Vuex for something and that's where we got stuck and switched.

It's a good job - at that stage in the project, it wouldn't have been a big problem so we didn't notice. If we had continued, I would have a hard time justifying a switch at that stage and could have been in a bit of a corner right now.

Props can have a type.
The type is verified at runtime though
It can also be verified at compile time when using vue-class-component.
If it's a primitive type, yes. Throw in a union, a generic, or a conditional and everything blows up.