Skip to content

Commit

Permalink
fix: avoid props type-checking for VNode
Browse files Browse the repository at this point in the history
close #2720
  • Loading branch information
johnsoncodehk committed Apr 26, 2023
1 parent 6032059 commit 32de584
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vue-language-core/src/utils/localTypes.ts
Expand Up @@ -14,6 +14,7 @@ export function getTypesCode(
import type {
ObjectDirective,
FunctionDirective,
VNode,
} from '${libName}';
export type IntrinsicElements = PickNotAny<import('vue/jsx-runtime').JSX.IntrinsicElements, PickNotAny<JSX.IntrinsicElements, Record<string, any>>>;
Expand Down Expand Up @@ -96,7 +97,7 @@ export declare function asFunctionalComponent<T, K = T extends new (...args: any
}) => JSX.Element & { __ctx?: typeof ctx & { props?: typeof props; expose?(exposed: K): void; } }
: 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
: (_: T extends import('vue').VNode ? {}: T & Record<string, unknown>, ctx?: any) => { __ctx?: { attrs?: unknown, expose?: unknown, slots?: unknown, emit?: unknown, props?: T & Record<string, unknown> } }; // IntrinsicElement
declare function functionalComponentArgsRest<T extends (...args: any) => any>(t: T): Parameters<T>['length'] extends 2 ? [any] : [];
export declare function pickEvent<Emit, K, E>(emit: Emit, emitKey: K, event: E): FillingEventArg<
PickNotAny<
Expand Down
12 changes: 12 additions & 0 deletions packages/vue-test-workspace/vue-tsc/#2720/main.vue
@@ -0,0 +1,12 @@
<template>
<div>
<component :is="component1"></component>
</div>
</template>

<script setup lang="ts">
import type { VNode } from 'vue';
import { h } from 'vue';
const component1: VNode = h('span', 'Foobar');
</script>

0 comments on commit 32de584

Please sign in to comment.