Compiler configuration

In the official documentation, the Vue team recommends that we configure the TypeScript compiler as follows:

{ 
  "compilerOptions": { 
    // this aligns with Vue's browser support 
    // feel free to go higher if you don't need to support older 
// environments "target": "es5", // we've seen how stricter inference is beneficial "strict": true, // to leverage tree shaking with Webpack, rollup and
// other bundlers "module": "es2015", "moduleResolution": "node" } }

The strict mode and, in particular, the implied noImplicitThis: true option, allow us to benefit from type checking this when writing Vue components.

Of course, you can target a higher version than ES5 if you don't need to support older web browsers such as IE11.

The Vue CLI that we introduced previously also includes support for TypeScript, so you can use it to create projects that have everything you need in order to write TypeScript-based Vue applications.