Hacker News new | ask | show | jobs
by lazarljubenovic 2817 days ago
> 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).

2 comments

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.