microsoft / TypeScript-Vue-Starter

A starter template for TypeScript and Vue with a detailed README describing how to use the two together.
MIT License
4.45k stars 592 forks source link

TypeScript interface is not working as expected, inside '.vue' files. #14

Closed CodeLookBook closed 7 years ago

CodeLookBook commented 7 years ago

TypeScript interface doesn't work as expected with '*.vue' files. it doesn't throw any "warning" when provided type is bad. Example form vue.js file:

<script lang="ts">

    interface Test {
       w: string;
       h: number;
    }

   // This part of code doesn't work. 
   // It doesn't show any message about 
   // type incompatibility 
   //(propert h must have "number" type).

   let myVar: Test = {
       w: "10",
       h: "26",
   };

   //At the same time this code works correctly in '.ts' files.

   </script>

My devDependencies info:

"devDependencies": {
"babel-plugin-transform-object-rest-spread": "",
"cross-env": "^3.2.3",
"laravel-mix": "0.",
"normalize.css": "",
"pug": "",
"ts-loader": "^2.2.0",
"typescript": "^2.3.4",
"vue": "",
"vue-resource": "",
"vue-router": "*"
},

I use:

Laravel framework(use 'WebPack', 'laravel-mix' - that gives default webpack setting and opportunity to modify them)

About typescript+vuejs configuration: I was using this instructions to configure my VueJs project: https://github.com/Microsoft/TypeScript-Vue-Starter . According to them I installed next NPM packages: