Skip to content

nullable v-model #5036

@valh1996

Description

@valh1996

Vue - Official extension

2.1.10

VSCode version

1.95.3

Vue version

^3.5.13

TypeScript version

^5.6.3

System Info

System:
    OS: macOS 14.6.1
    CPU: (12) arm64 Apple M3 Pro
    Memory: 644.78 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Yarn: 1.22.22 - ~/Library/pnpm/yarn
    npm: 10.9.0 - ~/Library/Application Support/Herd/config/nvm/versions/node/v22.11.0/bin/npm
    pnpm: 9.4.0 - /opt/homebrew/bin/pnpm
    bun: 1.0.26 - ~/.bun/bin/bun
  Browsers:
    Chrome: 131.0.6778.109
    Safari: 17.6

package.json dependencies

No response

Steps to reproduce

Following PR #4648, the bug seems to persist.
I'm using nuxt/ui where modeValue are nullable but null is not included in the type definition.

What is expected?

For the following type :

modelValue: {
  type: PropType<string | number | null>;
  default: string;
};

The TS definition should be string | number | undefined | null

What is actually happening?

null is not included in the type definition string | number | undefined

For nuxt/ui :

Cannot assign type 'string | null' to type 'string | number | undefined'.
Cannot assign type 'null' to type 'string | number | undefined'

Link to minimal reproduction

No response

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions