-
-
Notifications
You must be signed in to change notification settings - Fork 473
Closed
Labels
bugSomething isn't workingSomething isn't workinggood reproduction ✨This issue provides a good reproduction, we will be able to investigate it firstThis issue provides a good reproduction, we will be able to investigate it first
Description
I have defined the same component using <script setup>
and defineComponent
:
// CompSetup.vue
<script setup lang="ts" generic="T">
defineProps<{ msg: T; list: T[] }>();
</script>
// CompDefine.vue
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent(<T>(_: { msg: T; list: T[] }) => () => null);
</script>
When using them, CompSetup
automatically infers the types of arguments, however CompDefine
does not:
<template>
<CompSetup :msg="123" :list="['123']" />
<!-- Displays an error saying that `'string' is not assignable to 'number'` -->
<CompDefine :msg="123" :list="['123']" />
<!-- Displays no errors, when hovering over `:msg` and `:list` displays types `unknown` and `unknown[]` respectively -->
</template>
eva01pilot, s-montigny-desautels, joemaylor, kingyue737, cdani96 and 1 more
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood reproduction ✨This issue provides a good reproduction, we will be able to investigate it firstThis issue provides a good reproduction, we will be able to investigate it first