Skip to content

Commit e2b8456

Browse files
potato4dkazupon
authored andcommitted
feat: TypeScript support (#43)
* types: Install TypeScript environment * types: Define index.js types * type: remove typings * types: Use directly import and enhance component type def * types: Include AsyncComponent in component types
1 parent 166f6fc commit e2b8456

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

Diff for: package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"test": "jest",
1212
"lint": "eslint src",
1313
"build": "rollup -c",
14-
"prepare": "rollup -c"
14+
"prepare": "rollup -c",
15+
"test:types": "tsc -p ./types/tsconfig.json"
1516
},
1617
"repository": {
1718
"type": "git",
@@ -35,6 +36,7 @@
3536
"lint-staged": "^6.1.0",
3637
"puppeteer": "^1.0.0",
3738
"rollup": "^0.55.3",
39+
"typescript": "^3.2.2",
3840
"vue": "^2.5.13",
3941
"yorkie": "^1.0.3"
4042
},

Diff for: types/index.d.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import _Vue, { Component, AsyncComponent } from 'vue'
2+
3+
declare function wrap(
4+
Vue: typeof _Vue,
5+
Component: Component | AsyncComponent
6+
): HTMLElement
7+
8+
export default wrap

Diff for: types/tsconfig.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"compilerOptions": {
3+
"strict": true,
4+
"noEmit": true,
5+
"lib": [
6+
"es2015",
7+
"dom"
8+
]
9+
},
10+
"include": [
11+
"./*.ts"
12+
]
13+
}

Diff for: yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -3390,6 +3390,11 @@ typedarray@^0.0.6:
33903390
version "0.0.6"
33913391
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
33923392

3393+
typescript@^3.2.2:
3394+
version "3.2.2"
3395+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5"
3396+
integrity sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg==
3397+
33933398
uglify-js@^2.6:
33943399
version "2.8.29"
33953400
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd"

0 commit comments

Comments
 (0)