vue-component-type-helpers 1.5.3 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +2 -0
- package/index.js +30 -0
- package/package.json +3 -2
package/index.d.ts
CHANGED
package/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
exports.default = `
|
|
2
|
+
type ComponentProps<T> =
|
|
3
|
+
T extends new () => { $props: infer P } ? NonNullable<P> :
|
|
4
|
+
T extends (props: infer P, ...args: any) => any ? P :
|
|
5
|
+
{};
|
|
6
|
+
|
|
7
|
+
type ComponentSlots<T> =
|
|
8
|
+
T extends new () => { $slots: infer S } ? NonNullable<S> :
|
|
9
|
+
T extends (props: any, ctx: { slots: infer S }, ...args: any) => any ? NonNullable<S> :
|
|
10
|
+
{};
|
|
11
|
+
|
|
12
|
+
type ComponentEmit<T> =
|
|
13
|
+
T extends new () => { $emit: infer E } ? NonNullable<E> :
|
|
14
|
+
T extends (props: any, ctx: { emit: infer E }, ...args: any) => any ? NonNullable<E> :
|
|
15
|
+
{};
|
|
16
|
+
|
|
17
|
+
type ComponentExposed<T> =
|
|
18
|
+
T extends new () => infer E ? E :
|
|
19
|
+
T extends (props: any, ctx: { expose(exposed: infer E): any }, ...args: any) => any ? NonNullable<E> :
|
|
20
|
+
{};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Vue 2.x
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
type Vue2ComponentSlots<T> =
|
|
27
|
+
T extends new () => { $scopedSlots: infer S } ? NonNullable<S> :
|
|
28
|
+
T extends (props: any, ctx: { slots: infer S }, ...args: any) => any ? NonNullable<S> :
|
|
29
|
+
{};
|
|
30
|
+
`.trim();
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-component-type-helpers",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
|
+
"*.js",
|
|
6
7
|
"*.d.ts"
|
|
7
8
|
],
|
|
8
9
|
"repository": {
|
|
@@ -10,5 +11,5 @@
|
|
|
10
11
|
"url": "https://github.com/vuejs/language-tools.git",
|
|
11
12
|
"directory": "packages/vue-component-type-helpers"
|
|
12
13
|
},
|
|
13
|
-
"gitHead": "
|
|
14
|
+
"gitHead": "efa9b71f8bed110f8a7723942f86df2b7bcb1764"
|
|
14
15
|
}
|