Skip to content

[vue-component-meta] defineModel does not have default value #5208

@JoJk0

Description

@JoJk0

Vue - Official extension or vue-tsc version

2.2

VSCode version

latest

Vue version

3.5.13

TypeScript version

5.7.3

System Info

package.json dependencies

Steps to reproduce

Create a .vue SFC file and add defineModel clause with default value set

<script lang="ts" setup>
// ...

/**
 * Should the modal be open?
 */
const isOpen = defineModel<boolean>('isOpen', { default: false })
</script>

Run the component through the basic checker and observe lack of default value in returned object.

What is expected?

{
    "default": false,
    "name": "isOpen",
    "global": false,
    "description": "Should the modal be open?", 
    "tags": [],
    "required": false,
    "type": "boolean",
    "declarations": [],
    "schema": {
        "kind": "enum",
        "type": "boolean",
        "schema": [
            "false",
            "true"
        ]
    }
}

What is actually happening?

{
    "name": "isOpen",
    "global": false,
    "description": "", // Also no description - see https://github.com/vuejs/language-tools/issues/4592
    "tags": [],
    "required": false,
    "type": "boolean",
    "declarations": [],
    "schema": {
        "kind": "enum",
        "type": "boolean",
        "schema": [
            "false",
            "true"
        ]
    }
}

Link to minimal reproduction

No response

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions