Reputation: 2758
I'm trying to learn Vue and Typescript. But I can't seem to set it up 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 to something like this:
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!'
}
})
But instead I'm getting tons of errors when I run tsc. It seems as if it is trying to build the Vue definition files?
How can I get started working on Vue then with typescript? Are there any tutorials that can help me with this? I found a few online but none seem to be helping, or they are using other libraries such as av-ts which gives me the same problem
Upvotes: 4
Views: 3580
Reputation: 12659
This is the official document.
https://v2.vuejs.org/v2/guide/typescript.html
Also, why are you importing Vue from "../libs/vue/vue"?
That may be the cause of the problem.
If you have installed Vue.js with npm install vue
, you should write
import Vue = require('vue');
or
import * as Vue from 'vue';
Upvotes: 2