diff --git a/package-lock.json b/package-lock.json index 450482bea..fd7cc28af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8086,9 +8086,7 @@ } }, "vue": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/vue/-/vue-2.4.4.tgz", - "integrity": "sha512-PCiRmc8ZT1DD5+BN8QUAmnkBefcCLfZVSuhc1u7iu5JoPrSHyyk/+4nehm7k2xVMi8+RFLk5WIHAN14UKF0txw==", + "version": "github:vuejs/vue#dev", "dev": true }, "vue-hot-reload-api": { diff --git a/package.json b/package.json index ed008ccd4..e70e6a5bd 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "selenium-server": "^2.53.1", "typescript": "^2.5.3", "uglify-js": "^3.1.3", - "vue": "^2.4.4", + "vue": "github:vuejs/vue#dev", "vue-loader": "^13.3.0", "vue-template-compiler": "^2.4.4", "webpack": "^3.7.1", diff --git a/types/index.d.ts b/types/index.d.ts index ba118e243..087275cd7 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,21 +1,16 @@ import "./vue"; -import * as R from "./router"; +import { VueRouter } from "./router"; -// `VueRouter` in `export = VueRouter` must be a namespace -// All available types are exported via this namespace -declare namespace VueRouter { - export type RouterMode = R.RouterMode; - export type RawLocation = R.RawLocation; - export type RedirectOption = R.RedirectOption; - export type RouterOptions = R.RouterOptions; - export type RouteConfig = R.RouteConfig; - export type RouteRecord = R.RouteRecord; - export type Location = R.Location; - export type Route = R.Route; - export type NavigationGuard = R.NavigationGuard; -} +export default VueRouter; -// TS cannot merge imported class with namespace, declare a subclass to bypass -declare class VueRouter extends R.VueRouter {} - -export = VueRouter; +export { + RouterMode, + RawLocation, + RedirectOption, + RouterOptions, + RouteConfig, + RouteRecord, + Location, + Route, + NavigationGuard +} from "./router"; diff --git a/types/router.d.ts b/types/router.d.ts index 1ad77b4ef..e42be34b8 100644 --- a/types/router.d.ts +++ b/types/router.d.ts @@ -1,5 +1,4 @@ -import Vue = require("vue"); -import { ComponentOptions, PluginFunction, AsyncComponent } from "vue"; +import Vue, { ComponentOptions, PluginFunction, AsyncComponent } from "vue"; type Component = ComponentOptions | typeof Vue | AsyncComponent; type Dictionary = { [key: string]: T }; @@ -13,7 +12,7 @@ export type NavigationGuard = ( next: (to?: RawLocation | false | ((vm: Vue) => any) | void) => void ) => any -declare class VueRouter { +export declare class VueRouter { constructor (options?: RouterOptions); app: Vue; diff --git a/types/test/index.ts b/types/test/index.ts index 80db6aac8..e87cc51a8 100644 --- a/types/test/index.ts +++ b/types/test/index.ts @@ -1,7 +1,6 @@ -import Vue = require("vue"); -import { ComponentOptions, AsyncComponent } from "vue"; +import Vue, { ComponentOptions, AsyncComponent } from "vue"; -import VueRouter = require("../index"); +import VueRouter from "../index"; import { Route, RouteRecord, RedirectOption } from "../index"; Vue.use(VueRouter); diff --git a/types/test/tsconfig.json b/types/test/tsconfig.json index 064fc138d..0e29224d1 100644 --- a/types/test/tsconfig.json +++ b/types/test/tsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { "target": "es5", - "module": "commonjs", - "noImplicitAny": true, - "strictNullChecks": true, + "module": "es2015", + "moduleResolution": "node", + "strict": true, "noEmit": true, "lib": [ "es5", diff --git a/types/typings.json b/types/typings.json deleted file mode 100644 index 5b6122aaa..000000000 --- a/types/typings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "vue-router", - "main": "index.d.ts" -} diff --git a/types/vue.d.ts b/types/vue.d.ts index 37c3c44db..0210c9f0e 100644 --- a/types/vue.d.ts +++ b/types/vue.d.ts @@ -2,9 +2,8 @@ * Augment the typings of Vue.js */ -import Vue = require("vue"); -import VueRouter = require("./index"); -import { Route, RawLocation, NavigationGuard } from "./index"; +import Vue from "vue"; +import VueRouter, { Route, RawLocation, NavigationGuard } from "./index"; declare module "vue/types/vue" { interface Vue {