From 60df66feea5e42012547dc05bb33fe2549f6fd26 Mon Sep 17 00:00:00 2001 From: HANATANI Takuma Date: Mon, 31 Dec 2018 12:19:50 +0900 Subject: [PATCH 1/5] types: Install TypeScript environment --- package.json | 4 +++- types/tsconfig.json | 13 +++++++++++++ types/typings.json | 4 ++++ yarn.lock | 5 +++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 types/tsconfig.json create mode 100644 types/typings.json diff --git a/package.json b/package.json index f7ec743..83f4979 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "test": "jest", "lint": "eslint src", "build": "rollup -c", - "prepare": "rollup -c" + "prepare": "rollup -c", + "test:types": "tsc -p ./types/tsconfig.json" }, "repository": { "type": "git", @@ -35,6 +36,7 @@ "lint-staged": "^6.1.0", "puppeteer": "^1.0.0", "rollup": "^0.55.3", + "typescript": "^3.2.2", "vue": "^2.5.13", "yorkie": "^1.0.3" }, diff --git a/types/tsconfig.json b/types/tsconfig.json new file mode 100644 index 0000000..b3fd0f9 --- /dev/null +++ b/types/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "strict": true, + "noEmit": true, + "lib": [ + "es2015", + "dom" + ] + }, + "include": [ + "./*.ts" + ] +} diff --git a/types/typings.json b/types/typings.json new file mode 100644 index 0000000..a5efc3a --- /dev/null +++ b/types/typings.json @@ -0,0 +1,4 @@ +{ + "name": "@vue/vue-web-component-wrapper", + "main": "index.d.ts" +} diff --git a/yarn.lock b/yarn.lock index 2622dc1..b005ff2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3390,6 +3390,11 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" +typescript@^3.2.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5" + integrity sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg== + uglify-js@^2.6: version "2.8.29" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" From bbf4f9cd301a413d04e937695be412cffd3e7165 Mon Sep 17 00:00:00 2001 From: HANATANI Takuma Date: Mon, 31 Dec 2018 12:21:14 +0900 Subject: [PATCH 2/5] types: Define index.js types --- types/index.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 types/index.d.ts diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000..6d20d61 --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,8 @@ +import * as VueJS from 'vue' + +declare function wrap( + Vue: VueJS.default, + Component: VueJS.VueConstructor +): HTMLElement + +export default wrap From 549eea1f61c7617e3f92a5a8724b17bb27b0b036 Mon Sep 17 00:00:00 2001 From: HANATANI Takuma Date: Mon, 31 Dec 2018 17:02:33 +0900 Subject: [PATCH 3/5] type: remove typings --- types/typings.json | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 types/typings.json diff --git a/types/typings.json b/types/typings.json deleted file mode 100644 index a5efc3a..0000000 --- a/types/typings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "@vue/vue-web-component-wrapper", - "main": "index.d.ts" -} From ef8ecb9ade7fe50ac9f37b11d36b0c37c83994ac Mon Sep 17 00:00:00 2001 From: HANATANI Takuma Date: Wed, 16 Jan 2019 09:34:34 +0900 Subject: [PATCH 4/5] types: Use directly import and enhance component type def --- types/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 6d20d61..d323d50 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,8 +1,8 @@ -import * as VueJS from 'vue' +import _Vue, { Component } from 'vue' declare function wrap( - Vue: VueJS.default, - Component: VueJS.VueConstructor + Vue: typeof _Vue, + Component: Component ): HTMLElement export default wrap From 9c917cac5c05ebe1b4eadddab6ec2e625787edb0 Mon Sep 17 00:00:00 2001 From: HANATANI Takuma Date: Wed, 16 Jan 2019 11:47:32 +0900 Subject: [PATCH 5/5] types: Include AsyncComponent in component types --- types/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index d323d50..8b67b7b 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,8 +1,8 @@ -import _Vue, { Component } from 'vue' +import _Vue, { Component, AsyncComponent } from 'vue' declare function wrap( Vue: typeof _Vue, - Component: Component + Component: Component | AsyncComponent ): HTMLElement export default wrap