Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript error for Set with v-model #5811

Closed
edikdeisling opened this issue Apr 26, 2022 · 2 comments
Closed

Typescript error for Set with v-model #5811

edikdeisling opened this issue Apr 26, 2022 · 2 comments
Labels
🐞 bug Something isn't working scope: types

Comments

@edikdeisling
Copy link

Version

3.2.33

Reproduction link

github.com

Steps to reproduce

  1. Open project
  2. Run vue-tsc --noEmit

What is expected?

No TypeScript errors

What is actually happening?

There is a TypeScript error

src/App.vue:9:38 - error TS2322: Type 'Set<unknown>' is not assignable to type 'any[] | Booleanish | undefined'.
  Type 'Set<unknown>' is missing the following properties from type 'any[]': length, pop, push, concat, and 23 more.

9     <input type="checkbox" value="1" v-model="model">
                                       ~~~~~~~

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

src/App.vue:13:38 - error TS2322: Type 'Set<unknown>' is not assignable to type 'any[] | Booleanish | undefined'.

13     <input type="checkbox" value="2" v-model="model">
                                        ~~~~~~~

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


Found 2 errors.


According to documentation we can use Set with input[type=checkbox].
The code works, but vue-tsc alerts errors

Here is the minimum code to reproduce:

<script setup lang="ts">
  import { ref } from 'vue';

  const model = ref(new Set());
</script>

<template>
  <input type="checkbox" value="1" v-model="model">
</template>
@productdevbook
Copy link
Contributor

productdevbook commented Oct 2, 2022

Are there any related developments?

@sodatea
Copy link
Member

sodatea commented Mar 17, 2023

Fixed by #5713

@sodatea sodatea closed this as completed Mar 17, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐞 bug Something isn't working scope: types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants