Skip to content

After upgrading typescript complains about <input> v-model type #7749

@crystalfp

Description

@crystalfp

Vue version

3.2.47

Link to minimal reproduction

See below

Steps to reproduce

Perfectly valid code till now:

const selected = ref("")
<input v-model="selected" type="radio">

running vue-ts (or looking at the code inside VS Code) complains:

  node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts:646:3
    646   checked?: Booleanish | any[] | Set<any> // for IDE v-model multi-checkbox support
          ~~~~~~~
    The expected type comes from property 'checked' which is declared here on type 'ElementAttrs<InputHTMLAttributes>'

Changing selected to an array silences the error, but an input of type "radio" output one and only one value on output.
Is it a bug?

What is expected?

Continue as before without complaining

What is actually happening?

See above

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 10.92 GB / 31.77 GB
  Binaries:
    Node: 19.6.0 - C:\Program Files\nodejs\node.EXE
    npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 110.0.5481.100
    Edge: Spartan (44.22621.1265.0), Chromium (110.0.1587.46)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    vue: ^3.2.47 => 3.2.47

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions