-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(type): support auto completion for the useModal slots with type …
…ComponentSlots
- Loading branch information
1 parent
70f5d79
commit 7db7267
Showing
6 changed files
with
73 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* vue-component-type-helpers | ||
* Copy from https://github.com/vuejs/language-tools/tree/master/packages/component-type-helpers | ||
*/ | ||
|
||
// export type ComponentType<T> = | ||
// T extends new () => {} ? 1 : | ||
// T extends (...args: any) => any ? 2 : | ||
// 0 | ||
|
||
export type ComponentProps<T> = | ||
T extends new () => { $props: infer P } ? NonNullable<P> : | ||
T extends (props: infer P, ...args: any) => any ? P : | ||
{} | ||
|
||
export type ComponentSlots<T> = | ||
T extends new () => { $slots: infer S } ? NonNullable<S> : | ||
T extends (props: any, ctx: { slots: infer S; attrs: any; emit: any }, ...args: any) => any ? NonNullable<S> : | ||
{} | ||
|
||
// export type ComponentEmit<T> = | ||
// T extends new () => { $emit: infer E } ? NonNullable<E> : | ||
// T extends (props: any, ctx: { slots: any; attrs: any; emit: infer E }, ...args: any) => any ? NonNullable<E> : | ||
// {} | ||
|
||
// export type ComponentExposed<T> = | ||
// T extends new () => infer E ? E : | ||
// T extends (props: any, ctx: any, expose: (exposed: infer E) => any, ...args: any) => any ? NonNullable<E> : | ||
// {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters