Create a Vuex Store using TypeScript

Share this video with your friends

Send Tweet

A Vuex store centralizes the state of your app, making it easy to reason about your state flow.

In this lesson we’ll see how we can create a Vuex store using TypeScript and use it on you class-based component by using the @State decorator from Vuex Class

Victor Hazbun
Victor Hazbun
~ 7 years ago

Why Typescript? I think Typescript is a waste of time, since I can do the exact same things with JavaScript. Please explain why should we learn Typescript to build VueJS apps. Thanks.

Alex Jover Morales
Alex Jover Morales(instructor)
~ 7 years ago

Static typing (either TypeScript or Flow) comes in very handy for medium/large projects since it increases your code safety. It helps having easier refactorings, intellisense, easy-to-catch bugs, etc.

The Slack team wrote about what benefits they had from moving to TypeScript.

Please keep in mind that TypeScript is JavaScript. Is not a different language. Marius explains it very well in his article.

Jonathan Stiansen
Jonathan Stiansen
~ 6 years ago

Also Vue.js 3.0 just was announced on the horizon, and it will be written fully in TypeScript so the project maintainers are giving the 'approval' to it as well.

Victor, where are they @Component decorators coming from? I didn't see them in the Vue documentation.