How to use VueJS using Typescript?

I am trying to learn Vue and Typescript. But I can not configure it correctly.

I made an app.ts file with these lines of code:

import { Vue } from "../libs/vue/vue";

var app = new Vue({
    el: "#app",
    data: {
        message: 'Hello Vue!'
    }
}); 

I thought this would compile something like this:

var app = new Vue({
  el: '#app',
  data: {
    message: 'Hello Vue!'
  }
})

But instead, I get a ton of errors when I run tsc. Does it seem to be trying to create Vue definition files?Image here

How can I get started with Vue, then using typescript? Are there any tutorials that can help me with this? I found several online, but none of them help, or they use other libraries like av-ts that give me the same problem.

+4
source share
1 answer

This is an official document.

https://vuejs.org/v2/guide/typescript.html

, Vue "../libs/vue/vue"? . Vue.js npm install vue,

import Vue = require('vue');

import * as Vue from 'vue';
+2

Source: https://habr.com/ru/post/1665373/


All Articles