Subscribe on changes!

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

avatar
Feb 18th 2023

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

avatar
Feb 20th 2023

Fixed by vue-tsc new version (1.1.4). Thanks!