I'm currently working on enabling type checking in my Vue.js code (v2.2.1). My initial goal is to ensure that this specific line compiles with TypeScript (meaning I want the Vue class to be properly identified):
var app = new Vue();
I've discovered that it successfully compiles if I import Vue using:
import * as Vue from 'vue';
However, this approach results in a require()
call:
var Vue = require("vue");
Just to clarify, I am not using modules. Instead, I directly reference the Vue library from a CDN before my script.
I attempted referencing the definition file like this:
/// <reference path="../node_modules/vue/types/index.d.ts" />
Unfortunately, the Vue class isn't recognized (most likely because it's exported in the definition file and should ideally be imported?).
Is it possible to use import
solely for referencing the type definitions without actually 'requiring' the entire library?