Skip to content

Commit

Permalink
fix: more acurrate props type infer
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Dec 8, 2022
1 parent cc3a5ce commit 7cecb34
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vue-language-tools/vue-language-core/src/utils/localTypes.ts
Expand Up @@ -110,8 +110,10 @@ export type GetComponents<Components, N1, N2 = unknown, N3 = unknown> =
export type ComponentProps<T> =
${vueCompilerOptions.strictTemplates ? '' : 'Record<string, unknown> &'}
(
T extends new (...args: any) => any ? (T extends new (...args: any) => { $props: infer Props } ? Props : {})
: T extends (...args: any) => any ? (T extends (...args: any) => { props: infer Props } ? Props : {})
T extends new (...args: any) => { $props: infer Props } ? Props
: T extends (...args: any) => { props: infer Props } ? Props
: T extends new (...args: any) => any ? {}
: T extends (...args: any) => any ? {}
: T // IntrinsicElement
);
export type InstanceProps<I, C> = I extends { $props: infer Props } ? Props & Record<string, unknown> : C & Record<string, unknown>;
Expand Down

0 comments on commit 7cecb34

Please sign in to comment.