Skip to content

Commit 17c4c51

Browse files
committed
chore: use vue-tsc generate .vue.d.ts file
1 parent 5faa7f7 commit 17c4c51

File tree

6 files changed

+163
-81
lines changed

6 files changed

+163
-81
lines changed

buildTypes.ts

Lines changed: 0 additions & 60 deletions
This file was deleted.

lib/index.d.ts

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
1-
import type { Ref, Component } from 'vue'
1+
import type { Component } from 'vue'
2+
import IllestWaveform from './types/IllestWaveform.vue'
3+
import IllestWaveformProps from './types/IllestWaveformProps'
24

35
declare const _default: {
46
install: (app: Component) => void
57
}
68

7-
type CanvasLineCap = 'butt' | 'round' | 'square'
8-
9-
export type IllestWaveformProps = {
10-
url: string
11-
lineWidth?: number
12-
lineCap?: CanvasLineCap
13-
lineColor?: string
14-
samplingRate?: number
15-
cursorWidth?: number
16-
cursorColor?: string
17-
maskColor?: string
18-
lazy?: boolean | Ref<boolean>
19-
skeleton?: boolean | Ref<boolean>
20-
skeletonColor?: string
21-
interact?: boolean | Ref<boolean>
22-
}
23-
249
export default _default
10+
11+
export { IllestWaveform, IllestWaveformProps }

lib/types/IllestWaveform.vue.d.ts

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
declare const _default: import('vue').DefineComponent<
2+
__VLS_WithDefaults<
3+
__VLS_TypePropsToRuntimeProps<{
4+
url: string
5+
lineWidth?: number | undefined
6+
lineCap?: ('butt' | 'round' | 'square') | undefined
7+
lineColor?: string | undefined
8+
samplingRate?: number | undefined
9+
cursorWidth?: number | undefined
10+
cursorColor?: string | undefined
11+
maskColor?: string | undefined
12+
lazy?: boolean | Ref<boolean> | undefined
13+
skeleton?: boolean | Ref<boolean> | undefined
14+
skeletonColor?: string | undefined
15+
interact?: boolean | Ref<boolean> | undefined
16+
}>,
17+
{
18+
lineWidth: number
19+
lineCap: string
20+
lineColor: string
21+
cursorWidth: number
22+
cursorColor: string
23+
samplingRate: number
24+
maskColor: string
25+
lazy: boolean
26+
skeleton: boolean
27+
skeletonColor: string
28+
interact: boolean
29+
}
30+
>,
31+
{
32+
play: () => void
33+
pause: () => void
34+
replay: () => void
35+
getCurrentTime: () => string
36+
getDuration: () => string
37+
},
38+
unknown,
39+
{},
40+
{},
41+
import('vue').ComponentOptionsMixin,
42+
import('vue').ComponentOptionsMixin,
43+
(
44+
| 'onInit'
45+
| 'onFetched'
46+
| 'onReady'
47+
| 'onPlay'
48+
| 'onPause'
49+
| 'onFinish'
50+
| 'onClick'
51+
)[],
52+
| 'onInit'
53+
| 'onFetched'
54+
| 'onReady'
55+
| 'onPlay'
56+
| 'onPause'
57+
| 'onFinish'
58+
| 'onClick',
59+
import('vue').VNodeProps &
60+
import('vue').AllowedComponentProps &
61+
import('vue').ComponentCustomProps,
62+
Readonly<
63+
import('vue').ExtractPropTypes<
64+
__VLS_WithDefaults<
65+
__VLS_TypePropsToRuntimeProps<{
66+
url: string
67+
lineWidth?: number | undefined
68+
lineCap?: ('butt' | 'round' | 'square') | undefined
69+
lineColor?: string | undefined
70+
samplingRate?: number | undefined
71+
cursorWidth?: number | undefined
72+
cursorColor?: string | undefined
73+
maskColor?: string | undefined
74+
lazy?: boolean | Ref<boolean> | undefined
75+
skeleton?: boolean | Ref<boolean> | undefined
76+
skeletonColor?: string | undefined
77+
interact?: boolean | Ref<boolean> | undefined
78+
}>,
79+
{
80+
lineWidth: number
81+
lineCap: string
82+
lineColor: string
83+
cursorWidth: number
84+
cursorColor: string
85+
samplingRate: number
86+
maskColor: string
87+
lazy: boolean
88+
skeleton: boolean
89+
skeletonColor: string
90+
interact: boolean
91+
}
92+
>
93+
>
94+
> & {
95+
onOnInit?: ((...args: any[]) => any) | undefined
96+
onOnFetched?: ((...args: any[]) => any) | undefined
97+
onOnReady?: ((...args: any[]) => any) | undefined
98+
onOnPlay?: ((...args: any[]) => any) | undefined
99+
onOnPause?: ((...args: any[]) => any) | undefined
100+
onOnFinish?: ((...args: any[]) => any) | undefined
101+
onOnClick?: ((...args: any[]) => any) | undefined
102+
},
103+
{
104+
lineWidth: number
105+
lineCap: 'butt' | 'round' | 'square'
106+
lineColor: string
107+
samplingRate: number
108+
cursorWidth: number
109+
cursorColor: string
110+
maskColor: string
111+
lazy: boolean | Ref<boolean>
112+
skeleton: boolean | Ref<boolean>
113+
skeletonColor: string
114+
interact: boolean | Ref<boolean>
115+
}
116+
>
117+
export default _default
118+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T
119+
type __VLS_TypePropsToRuntimeProps<T> = {
120+
[K in keyof T]-?: {} extends Pick<T, K>
121+
? {
122+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>
123+
}
124+
: {
125+
type: import('vue').PropType<T[K]>
126+
required: true
127+
}
128+
}
129+
type __VLS_WithDefaults<P, D> = {
130+
[K in keyof Pick<P, keyof P>]: K extends keyof D
131+
? P[K] & {
132+
default: D[K]
133+
}
134+
: P[K]
135+
}

lib/types/IllestWaveformProps.d.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { Ref } from 'vue'
2+
3+
type CanvasLineCap = 'butt' | 'round' | 'square'
4+
5+
type IllestWaveformProps = {
6+
url: string
7+
lineWidth?: number
8+
lineCap?: CanvasLineCap
9+
lineColor?: string
10+
samplingRate?: number
11+
cursorWidth?: number
12+
cursorColor?: string
13+
maskColor?: string
14+
lazy?: boolean | Ref<boolean>
15+
skeleton?: boolean | Ref<boolean>
16+
skeletonColor?: string
17+
interact?: boolean | Ref<boolean>
18+
}
19+
20+
export default IllestWaveformProps

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
},
3232
"scripts": {
3333
"build": "vite build --outDir lib",
34-
"build:types": "deno run --allow-env --allow-read --allow-write buildTypes.ts",
34+
"build:types": "vue-tsc --declaration --emitDeclarationOnly --declarationDir ./lib/types",
3535
"lint": "eslint src --ext .ts,.vue",
3636
"prepare": "husky install"
3737
},
@@ -54,6 +54,6 @@
5454
"prettier": "^2.8.3",
5555
"typescript": "^4.6.4",
5656
"vite": "^3.2.0",
57-
"vue-tsc": "^1.0.9"
57+
"vue-tsc": "^1.2.0"
5858
}
5959
}

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)