Skip to content

v-model without v-model:modelValue not type checked in template when defineModel is used #4540

Closed
@davidmatter

Description

@davidmatter

Discussed in #4529

Originally posted by Quartoffel July 4, 2024
Hey,

I have a problem that my v-model (or any v-* for that matter) are neither type checked nor show any intellisense information. Normal props work fine (even :model-value). I am not sure why this happens. Maybe someone has any ideas how to debug/fix this. Here are two pictures to show the issue in action:

  1. Here it correctly throws an error because of type mismatch
    Correctly checks the value

  2. Here it does not (and also does not show any Intellisense on hover):
    Does not check model-value

Test2.vue is just:

<template>
  <div>{{ model }}</div>
</template>

<script setup lang="ts">
const model = defineModel<string>();
</script>

Information about my setup:
System:
OS: Windows 10 10.0.19045
CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
Memory: 16.40 GB / 31.93 GB
Binaries:
Node: 20.11.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.4.0 - ~\AppData\Local\pnpm\pnpm.CMD
Browsers:
Edge: Chromium (126.0.2592.87)
Internet Explorer: 11.0.19041.4355

Vue - Official/vue-tsc Version: 2.0.26
Vue: 3.4.31
Typescript: 5.5.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood reproduction ✨This issue provides a good reproduction, we will be able to investigate it first

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions