Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defineProps conflicts with defineModel in template #4799

Closed
robertmoura opened this issue Sep 4, 2024 · 0 comments · Fixed by #4800
Closed

defineProps conflicts with defineModel in template #4799

robertmoura opened this issue Sep 4, 2024 · 0 comments · Fixed by #4800
Labels
bug Something isn't working good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first 🔨 p3-minor-bug

Comments

@robertmoura
Copy link

robertmoura commented Sep 4, 2024

Vue - Official extension or vue-tsc version

2.1.4

VSCode version

1.92.2

Vue version

3.5.0

TypeScript version

5.5.4

System Info

System:
    OS: macOS 14.6.1
    CPU: (8) arm64 Apple M1
    Memory: 102.73 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.1.0 - /usr/local/bin/node
    Yarn: 4.4.0 - /usr/local/bin/yarn
    npm: 10.7.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 128.0.6613.114
    Edge: 128.0.2739.63
    Safari: 17.6

package.json dependencies

No response

Steps to reproduce

Create a Vue file with the following content:

<template>
    <div>
        {{ something }}
    </div>
</template>

<script lang="ts" setup>
defineProps({
    something: String,
});

defineModel();
</script>

What is expected?

The type of something should be string | undefined.

What is actually happening?

I am getting the following error:

Property 'something' does not exist on type 'CreateComponentPublicInstanceWithMixins<Readonly<__VLS_PublicProps & { "onUpdate:modelValue"?: ((modelValue: any) => any) | undefined; }>, {}, {}, {}, {}, ComponentOptionsMixin, ... 18 more ..., {}>'. ts-plugin(2339)

This also happens when I run vue-tsc.

Screenshot 2024-09-04 at 2 03 31 PM

Link to minimal reproduction

No response

Any additional comments?

It seems like there is a conflict between defineProps and defineModel.

@robertmoura robertmoura changed the title Template props conflict with defineModel defineProps conflicts with defineModel in template Sep 4, 2024
@KazariEX KazariEX added bug Something isn't working good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first 🔨 p3-minor-bug and removed pending triage labels Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first 🔨 p3-minor-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants