Skip to content

Commit

Permalink
fix: <Suspense> slot type error
Browse files Browse the repository at this point in the history
close #2683
  • Loading branch information
johnsoncodehk committed Apr 23, 2023
1 parent 50b0c66 commit 173810a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/vue-language-core/src/utils/localTypes.ts
Expand Up @@ -88,10 +88,13 @@ export type EmitEvent<F, E> =
} ? (...payload: P) => void
: unknown | '[Type Warning] Volar could not infer $emit event more than 4 overloads without DefineComponent. see https://github.com/johnsoncodehk/volar/issues/60';
export declare function asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
T extends new (...args: any) => any ?
K extends { $props?: infer Props, $slots?: infer Slots, $emit?: infer Emit }
? (props: Props ${vueCompilerOptions.strictTemplates ? '' : '& Record<string, unknown>'}, ctx?: { attrs?: any, expose?(exposed: K): void, slots?: Slots, emit?: Emit }) => JSX.Element & { __ctx?: typeof ctx, __props?: typeof props }
: never
T extends new (...args: any) => any
? (props: (K extends { $props: infer Props } ? Props : any)${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}, ctx?: {
attrs?: any,
expose?(exposed: K): void,
slots?: K extends { $slots: infer Slots } ? Slots : any,
emit?: K extends { $emit: infer Emit } ? Emit : any
}) => JSX.Element & { __ctx?: typeof ctx, __props?: typeof props }
: T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
: T extends (...args: any) => any ? T
: (_: T & Record<string, unknown>, ctx?: any) => { __ctx?: { attrs?: unknown, expose?: unknown, slots?: unknown, emit?: unknown }, __props?: T & Record<string, unknown> }; // IntrinsicElement
Expand Down
5 changes: 5 additions & 0 deletions packages/vue-test-workspace/vue-tsc/#2683/main.vue
@@ -0,0 +1,5 @@
<template>
<Suspense>
<template #default></template>
</Suspense>
</template>

0 comments on commit 173810a

Please sign in to comment.