Skip to content

Commit

Permalink
fix: functional component type check not working when return type inc…
Browse files Browse the repository at this point in the history
…ludes `props`

close #2206
  • Loading branch information
johnsoncodehk committed Dec 25, 2022
1 parent 774420c commit 2fb66c8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Expand Up @@ -111,6 +111,7 @@ export type ComponentProps<T> =
${vueCompilerOptions.strictTemplates ? '' : 'Record<string, unknown> &'}
(
T extends new (...args: any) => { $props: infer Props } ? Props
: T extends (props: infer Props, ...args: any) => any ? Props
: T extends (...args: any) => { props: infer Props } ? Props
: T extends new (...args: any) => any ? {}
: T extends (...args: any) => any ? {}
Expand Down
18 changes: 18 additions & 0 deletions vue-language-tools/vue-test-workspace/vue-tsc/#2206/main.vue
@@ -0,0 +1,18 @@
<template>
<A :foo="v => exactType(v, {} as string)"></A>
<B :foo="v => exactType(v, {} as string)"></B>
<C :foo="v => exactType(v, {} as string)"></C>
<D :foo="v => exactType(v, {} as string)"></D>
</template>

<script lang="ts">
import { exactType } from 'vue-tsc/shared';
declare const A: (props: { foo: (_: string) => void; }) => void;
declare const B: (props: { foo: (_: string) => void; }, _1: {}) => void;
declare const C: (props: { foo: (_: string) => void; }, _1: {}, _2: {}) => void;
declare const D: (props: { foo: (_: string) => void; }) => { props: {} };
</script>

<script lang="ts" setup>
</script>

0 comments on commit 2fb66c8

Please sign in to comment.