I am now using nathantreid:vue-typescript-babel
(https://github.com/nathantreid/meteor-vue-typescript-babel) to provide TypeScript in my Vue components.
This meteor package adds TypeScript support in your single-file .vue
components.
This package is an add-on for akryum:vue-component. You must first have that package installed.
meteor add nathantreid:vue-typescript
Set your script's lang
attribute to ts
or typescript
:
<script lang="ts">
let message: string;
export default {
mounted() {
message = 'world';
console.log(`Hello, ${message}!`);
}
}
</script>
Or with vue-class-component
:
<script lang="typescript">
import Vue from 'vue'
import Component from 'vue-class-component'
let message: string;
@Component
export default class MyButton extends Vue {
mounted() {
message = 'world';
console.log(`Hello, ${message}!`);
}
}
</script>
This plugin only handles compilation of TypeScript within .vue files. To import other TypeScript files, you must install a .ts compiler such as barbatus:typescript.
Compilation is handled by barbatus:typescript-compiler and therefore supports the same options as barbatus/typescript. For more information about compiler options, please see the above link.
LICENCE ISC - Created by Nathan Reid (@nathantreid)