In package.json I have
"devDependencies": {
"vue": "2.5.16"
}
which gives me index.d.ts, vue.d.ts and so on in node_modules\vue\types. At first I had the problem that vue was not found ((TS) Cannot find name 'Vue') when doing something like new Vue({...});. After reading this thread I fixed it with adding a custom.d.ts file:
import _vue = require('vue');
declare global {
const Vue: typeof _vue;
}
And referencing it with /// <reference path="../Declarations/custom.d.ts" />
Apparently the reason is that vue's declaration are in external module format (using export) and global module is needed if no module system is used.
But now IntelliSense gives me: "(TS) Cannot use 'new' with an expression whose type lacks a call or construct signature." and the build fails.
I'm using TypeScript 2.8 with outFile and no modules (just reference xml comments).
Edit: I thought I found the answer by using
const Vue: typeof _vue.default;
which makes the errors for the new Vue() statement go away. But when I try to declare a variable of type Vue I get the Cannot find name 'Vue' error again:
var app = new Vue({}); // Works
var app2:Vue = new Vue({}); // Doesn't work