vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.87k stars 400 forks source link

Type check error when using local name different from prop name with runtime api #4649

Closed KazariEX closed 2 months ago

KazariEX commented 3 months ago

Vue - Official extension or vue-tsc version

2.0.28

VSCode version

1.92.0-Insider

Vue version

3.5.0-alpha.5

TypeScript version

5.5.4

System Info

No response

Steps to reproduce

<script lang="ts" setup>
import Child from './component.vue';

const model = '1';
const foo = '1';
const bar = '1';
</script>

<template>
    <Child
        v-model="model"
        v-model:foo="foo"
        v-model:bar="bar"
    />
</template>
<script lang="ts" setup>
const modelAlias = defineModel({
    type: Number,
    required: true
});
const fooAlias = defineModel('foo', {
    type: Number,
    default: 1
});
const barAlias = defineModel('bar', {
    default: 1
});
</script>

What is expected?

Correct type inference.

What is actually happening?

All props got any type.

Link to minimal reproduction

No response

Any additional comments?

No response