Skip to content

Commit f86e32a

Browse files
Merge pull request #15 from Mini-ghost/master
feat(types): add typescript support
2 parents 48a2350 + 5ff9700 commit f86e32a

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
dist
1+
dist
2+
types/**/*.d.ts

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
"jsnext:main": "dist/VueFinalModal.esm.js",
99
"unpkg": "dist/VueFinalModal.umd.js",
1010
"jsdelivr": "dist/VueFinalModal.umd.js",
11+
"types": "types/index.d.ts",
1112
"files": [
1213
"lib",
13-
"dist"
14+
"dist",
15+
"types/index.d.ts"
1416
],
1517
"scripts": {
1618
"build": "rollup -c --environment BUILD:production",

types/index.d.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import Vue, { PluginFunction } from 'vue'
2+
3+
export class VueFinalModalComponant extends Vue {
4+
$refs: {
5+
vfmContainer: HTMLDivElement,
6+
vfmContent: HTMLDivElement
7+
}
8+
}
9+
10+
declare module 'vue/types/vue' {
11+
interface Vue {
12+
readonly $vfm: {
13+
readonly openedModals: VueFinalModalComponant[]
14+
readonly modals: VueFinalModalComponant[]
15+
show(name: string): void
16+
hide(name: string): void
17+
hideAll(): void
18+
toggle(name: string, show: boolean): void
19+
}
20+
}
21+
}
22+
23+
export default class VueFinalModal {
24+
static install(vue: typeof Vue): PluginFunction<never>
25+
}

0 commit comments

Comments
 (0)