Explorar el Código

feat(typings): adapt to the new Vue typings (#909)

* feat(typings): adapt to the new vue typings

BREAKING CHANGE: It is no longer compatible with the old Vue typings

* chore(package): bump typescript and vue core typings

* chore: bump vue

* Update package.json
katashin hace 7 años
padre
commit
65dbfec40d

+ 1 - 3
package-lock.json

@@ -7988,9 +7988,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": {

+ 2 - 2
package.json

@@ -67,9 +67,9 @@
     "todomvc-app-css": "^2.1.0",
     "typescript": "^2.1.5",
     "uglify-js": "^3.1.2",
-    "vue": "^2.4.3",
+    "vue": "github:vuejs/vue#dev",
     "vue-loader": "^13.0.5",
-    "vue-template-compiler": "^2.4.3",
+    "vue-template-compiler": "^2.4.4",
     "webpack": "^3.6.0",
     "webpack-dev-middleware": "^1.10.0",
     "webpack-hot-middleware": "^2.19.1"

+ 1 - 1
types/helpers.d.ts

@@ -1,4 +1,4 @@
-import Vue = require("vue");
+import Vue from 'vue';
 import { Dispatch, Commit } from './index';
 
 type Dictionary<T> = { [key: string]: T };

+ 6 - 2
types/index.d.ts

@@ -1,5 +1,4 @@
-import _Vue = require("vue");
-import { WatchOptions } from "vue";
+import _Vue, { WatchOptions } from "vue";
 
 // augment typings of Vue.js
 import "./vue";
@@ -121,3 +120,8 @@ export interface MutationTree<S> {
 export interface ModuleTree<R> {
   [key: string]: Module<any, R>;
 }
+
+export default {
+  Store,
+  install
+};

+ 1 - 1
types/test/helpers.ts

@@ -1,4 +1,4 @@
-import Vue = require("vue");
+import Vue from "vue";
 
 import {
   mapState,

+ 1 - 1
types/test/index.ts

@@ -1,4 +1,4 @@
-import Vue = require("vue");
+import Vue from "vue";
 import * as Vuex from "../index";
 import createLogger from "../../dist/logger";
 

+ 3 - 3
types/test/tsconfig.json

@@ -1,15 +1,15 @@
 {
   "compilerOptions": {
-    "module": "commonjs",
     "target": "es5",
+    "module": "es2015",
+    "moduleResolution": "node",
     "lib": [
       "es5",
       "dom",
       "es2015.promise",
       "es2015.core"
     ],
-    "noImplicitAny": true,
-    "strictNullChecks": true,
+    "strict": true,
     "noEmit": true
   },
   "include": [

+ 1 - 1
types/test/vue.ts

@@ -1,4 +1,4 @@
-import Vue = require("vue");
+import Vue from "vue";
 import * as Vuex from "../index";
 
 const store = new Vuex.Store({

+ 3 - 3
types/tsconfig.json

@@ -1,14 +1,14 @@
 {
   "compilerOptions": {
-    "module": "commonjs",
     "target": "es5",
+    "module": "es2015",
+    "moduleResolution": "node",
     "lib": [
       "es5",
       "dom",
       "es2015.promise"
     ],
-    "noImplicitAny": true,
-    "strictNullChecks": true,
+    "strict": true,
     "noEmit": true
   },
   "include": [

+ 0 - 4
types/typings.json

@@ -1,4 +0,0 @@
-{
-  "name": "vuex",
-  "main": "index.d.ts"
-}

+ 1 - 1
types/vue.d.ts

@@ -2,7 +2,7 @@
  * Extends interfaces in Vue.js
  */
 
-import Vue = require("vue");
+import Vue, { ComponentOptions } from "vue";
 import { Store } from "./index";
 
 declare module "vue/types/options" {