Skip to content

Commit

Permalink
fix(component-type-helpers): correct type inference for FunctionalCom…
Browse files Browse the repository at this point in the history
…ponent
  • Loading branch information
pinguet62 committed Nov 30, 2023
1 parent 6f85019 commit 082abab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/component-type-helpers/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export type ComponentProps<T> =

export type ComponentSlots<T> =
T extends new () => { $slots: infer S; } ? NonNullable<S> :
T extends (props: any, ctx: { slots: infer S; }, ...args: any) => any ? 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: { emit: infer E; }, ...args: any) => any ? NonNullable<E> :
T extends (props: any, ctx: { slots: any; attrs: any; emit: infer E; }, ...args: any) => any ? NonNullable<E> :
{};

export type ComponentExposed<T> =
Expand Down
4 changes: 2 additions & 2 deletions packages/component-type-helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export type ComponentProps<T> =
export type ComponentSlots<T> =
T extends new () => { $slots: infer S; } ? NonNullable<S> :
T extends (props: any, ctx: { slots: infer S; }, ...args: any) => any ? 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: { emit: infer E; }, ...args: any) => any ? NonNullable<E> :
T extends (props: any, ctx: { slots: any; attrs: any; emit: infer E; }, ...args: any) => any ? NonNullable<E> :
{};
export type ComponentExposed<T> =
Expand Down

0 comments on commit 082abab

Please sign in to comment.