Skip to content

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

Closed
@KazariEX

Description

@KazariEX

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions