Skip to content

Commit

Permalink
fix: cannot infer slots type in vue2
Browse files Browse the repository at this point in the history
close #2682
  • Loading branch information
johnsoncodehk committed Apr 23, 2023
1 parent 173810a commit 312bcd3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vue-language-core/src/utils/localTypes.ts
@@ -1,4 +1,5 @@
import { VueCompilerOptions } from '../types';
import { getSlotsPropertyName } from './shared';
import { getVueLibraryName } from './shared';

export const typesFileName = '__VLS_types.d.ts';
Expand Down Expand Up @@ -92,7 +93,7 @@ export declare function asFunctionalComponent<T, K = T extends new (...args: 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,
slots?: K extends { ${getSlotsPropertyName(vueCompilerOptions.target)}: 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>
Expand Down

0 comments on commit 312bcd3

Please sign in to comment.