Hacker News new | ask | show | jobs
by The_rationalist 1612 days ago
Vue 3 is written in typescript and does type check props at both compile time and runtime.
1 comments

Not very nicely: https://v3.vuejs.org/guide/typescript-support.html#annotatin...

Does it type check templates yet?

Nobody should still use the awful legacy vue component syntax, it is trivial and much cleaner to migrate to script setup components, which do provide properly type checked props easily https://v3.vuejs.org/api/sfc-script-setup.html#defineprops-a... https://v3.vuejs.org/api/sfc-script-setup.html#typescript-on... (although vue class component is still the best API of all VDOMs, it's unfortunate its development has stalled)

Webstorm now properly supports template type checking too https://blog.jetbrains.com/webstorm/2021/11/webstorm-2021-3/...

Nobody should use the thing that the documentation tells you to use...

Vue 3 looks a lot better than Vue 2 but honestly it's just playing catch up to React. I don't know why you'd choose it.

It might interest you that Wikipeida chose Vue to modernise its frontend in the future [1]. Different frameworks offer different benefits and different downsides.

React is not the end-all, nor will it ever be, as long as there are interesting new projects coming out, and neither is Vue or Svelte. My website uses React, but personally I would rather use Vue or Svelte in the future.

[1]: https://phabricator.wikimedia.org/T241180

Yeah we chose Vue at work too, but it was only because we didn't have enough experience of either.

> Wikipeida chose Vue

Yeah their reasons look very much like dubious attempts to justify the choice someone has already made.

1. You can use it without a build step.

Sure, but only if you're not using Typescript, which would be mad. A build step is a mild inconvenience. Not something that should cause you to choose a worse solution (though they do also use PHP so they're probably used to bad tech).

2. Vue.js may enable us to rely on fewer libraries as dependencies.

Ha! When I added Vue and its required CLI stuff to our package.json it pulled in around 1000 dependencies. React has like 4.

3. The official Vue libraries are evolving in a stable and predictable fashion.

You can still use React classes if you want to. They're not deprecated. It's unlikely they ever will be.

4. Vue.js development is not led by a single corporation whose goals may diverge from those of the WMF.

I mean... come on.