From 9e31974e818a25ec4b77a4524d8be2ea3d620c0b Mon Sep 17 00:00:00 2001 From: xiaomi <391147815@qq.com> Date: Thu, 5 Jul 2018 20:47:49 +0800 Subject: [PATCH 1/2] fix --- .eslintrc.js | 3 ++- package.json | 20 ++++++++++-------- types/index.d.ts | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 10 deletions(-) create mode 100644 types/index.d.ts diff --git a/.eslintrc.js b/.eslintrc.js index a388ba2..8b7368f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -11,7 +11,8 @@ module.exports = { extends: 'eslint:recommended', // required to lint *.vue files plugins: [ - 'html' + 'html', + 'json' ], // check if imports actually resolve 'settings': { diff --git a/package.json b/package.json index 090c274..444f0d2 100644 --- a/package.json +++ b/package.json @@ -8,10 +8,12 @@ "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot --content-base='./demo/'", "build": "cross-env NODE_ENV=production webpack --progress --hide-modules" }, + "typings": "types/index.d.ts", "license": "MIT", "homepage": "http://panjiachen.github.io/countTo/demo/", "devDependencies": { "babel-core": "^6.0.0", + "babel-eslint": "7.1.1", "babel-loader": "^6.0.0", "babel-plugin-transform-runtime": "^6.15.0", "babel-preset-es2015": "^6.14.0", @@ -19,18 +21,18 @@ "babel-runtime": "^6.11.6", "cross-env": "^3.0.0", "css-loader": "^0.25.0", - "file-loader": "^0.9.0", - "vue-loader": "^11.1.4", - "vue-template-compiler": "^2.2.1", - "webpack": "^2.2.0", - "webpack-dev-server": "^2.2.0", - "babel-eslint": "7.1.1", "eslint": "3.14.1", + "eslint-config-airbnb-base": "11.0.1", "eslint-friendly-formatter": "2.0.7", + "eslint-import-resolver-webpack": "0.8.1", "eslint-loader": "1.6.1", "eslint-plugin-html": "2.0.0", - "eslint-config-airbnb-base": "11.0.1", - "eslint-import-resolver-webpack": "0.8.1", - "eslint-plugin-import": "2.2.0" + "eslint-plugin-import": "2.2.0", + "file-loader": "^0.9.0", + "vue": "^2.5.16", + "vue-loader": "^11.1.4", + "vue-template-compiler": "^2.2.1", + "webpack": "^2.2.0", + "webpack-dev-server": "^2.2.0" } } diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000..b551f93 --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,55 @@ +// Type definitions for vue-count-to 1.0.13 +// Project: https://github.com/PanJiaChen/vue-countTo +// Definitions by: mimimile +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import Vue from 'vue' + +export declare class VueCountTo extends Vue { + // the value you want to begin at + startVal: number + + // the value you want to arrive at + endVal: number + + // duration in millisecond + duration: number + + // when mounted autoplay + autoplay: boolean + + // the number of decimal places to show + decimals: number + + // the split decimal + decimal: string + + // the separator + separator: string + + // the prefix + prefix: string + + // the suffix + suffix: string + + // is use easing function + useEasing: boolean + + // the easing function + easingFn: Function + + // when mounted will emit mountedCallback + mountedCallback (): void + + // start the countTo + start (): void + + // pause the countTo + pause (): void + + // reset the countTo + reset (): void +} + From 4de08a6f6e7f119c18a524791f2e0a12ccda6c00 Mon Sep 17 00:00:00 2001 From: xiaomi <391147815@qq.com> Date: Fri, 6 Jul 2018 15:23:56 +0800 Subject: [PATCH 2/2] add new type --- types/index.d.ts | 67 ++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index b551f93..2244bfe 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -4,52 +4,53 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -import Vue from 'vue' +import Vue, { ComponentOptions } from 'vue' -export declare class VueCountTo extends Vue { - // the value you want to begin at - startVal: number +declare module '*.vue' { + interface ComponentOptions { + // the value you want to begin at + startVal: number - // the value you want to arrive at - endVal: number + // the value you want to arrive at + endVal: number - // duration in millisecond - duration: number + // duration in millisecond + duration: number - // when mounted autoplay - autoplay: boolean + // when mounted autoplay + autoplay: boolean - // the number of decimal places to show - decimals: number + // the number of decimal places to show + decimals: number - // the split decimal - decimal: string + // the split decimal + decimal: string - // the separator - separator: string + // the separator + separator: string - // the prefix - prefix: string + // the prefix + prefix: string - // the suffix - suffix: string + // the suffix + suffix: string - // is use easing function - useEasing: boolean + // is use easing function + useEasing: boolean - // the easing function - easingFn: Function + // the easing function + easingFn: Function - // when mounted will emit mountedCallback - mountedCallback (): void + // when mounted will emit mountedCallback + mountedCallback (): void - // start the countTo - start (): void + // start the countTo + start (): void - // pause the countTo - pause (): void + // pause the countTo + pause (): void - // reset the countTo - reset (): void + // reset the countTo + reset (): void + } } -