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

[Bug Report][3.3.19] TS error when supplying VAutocomplete with items of generic type #18361

Closed
MelvinFrohike opened this issue Sep 28, 2023 · 1 comment
Labels
S: stale This issue is untriaged and hasn't seen any activity in at least six months. S: triage

Comments

@MelvinFrohike
Copy link

Environment

Vuetify Version: 3.3.19
Vue Version: 3.3.4
Browsers: Safari 16.6
OS: Mac OS 10.15.7

Steps to reproduce

When supplying VAutocomplete with items of a generic type, v-model is marked with an error, e.g. "type 'string' is not assignable to type 'Val$2<t, false>'."

<template>
  <v-app>
    <v-container>
      <v-autocomplete
        v-model="selection"
        :items="items"
        item-value="value"
        item-title="title"
      />
    </v-container>
  </v-app>
</template>

<script setup lang="ts" generic="T">
  // generic="T extends Item" also fails with the same error
         import { ref } from 'vue'
         import { Item } from './Item';

     const items: T[] = []
     const selection = ref<string>(null)
</script>

Expected Behavior

This should work without an error

Actual Behavior

An error appears on v-model

Reproduction Link

https://play.vuetifyjs.com/#...

Other comments

This seems to be related to issue #17383 as this had the same kind of error if v-model was supplied with a generic type.

@bjacobgordon
Copy link

I also had this issue. I evaluated the Val$2<T, false> type myself using the declarations in the vuetify build, and it simplified to any | null | undefined. I ended up casting the selection to any | null and disabling "no-explicit-any" just to show that the issue had been investigated in my code base.

@github-actions github-actions bot added the S: stale This issue is untriaged and hasn't seen any activity in at least six months. label May 31, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: stale This issue is untriaged and hasn't seen any activity in at least six months. S: triage
Projects
None yet
Development

No branches or pull requests

2 participants