Skip to content

Commit

Permalink
fix: native tags event type become never
Browse files Browse the repository at this point in the history
close #2640
  • Loading branch information
johnsoncodehk committed Apr 21, 2023
1 parent bf8b431 commit a94cd7b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/vue-language-core/src/utils/localTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,18 @@ export declare function asFunctionalComponent<T, K = T extends new (...args: any
: T extends (...args: any) => any ? T
: 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 }
: (_: T & Record<string, unknown>, ctx?: any) => { __ctx?: { attrs?: undefined, expose?: undefined, slots?: undefined, emit?: undefined }, __props?: T & Record<string, unknown> }; // IntrinsicElement
: (_: T & Record<string, unknown>, ctx?: any) => { __ctx?: { attrs?: unknown, expose?: unknown, slots?: unknown, emit?: unknown }, __props?: T & Record<string, unknown> }; // IntrinsicElement
export declare function pickEvent<Emit, K, E>(emit: Emit, emitKey: K, event: E): FillingEventArg<
PickNotAny<
asFunctionOrAny<NonNullable<E>>,
asFunctionOrAny<NonNullable<EmitEvent<Emit, K>>>
AsFunctionOrAny<NonNullable<E>>,
AsFunctionOrAny<NonNullable<EmitEvent<Emit, K>>>
>
>;
export declare function pickFunctionalComponentCtx<T, K>(comp: T, compInstance: K): PickNotAny<
K extends { __ctx?: infer Ctx } ? Ctx : any,
T extends (props: any, ctx: infer Ctx) => any ? Ctx : any
>;
type asFunctionOrAny<F> = F extends ((...args: any) => any) ? F : any;
type AsFunctionOrAny<F> = F extends ((...args: any) => any) ? F : any;
`.trim();
}

Expand Down
11 changes: 11 additions & 0 deletions packages/vue-test-workspace/vue-tsc/#2640/main.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<view @tap="test()"></view>
</template>

<script setup lang="ts">
import { h } from 'vue';
const test = () => {
return h('p', {}, 'test');
};
</script>

0 comments on commit a94cd7b

Please sign in to comment.