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

QOptionGroup invalid type of options for typescript #17710

Open
hyperion-cs opened this issue Dec 18, 2024 · 0 comments
Open

QOptionGroup invalid type of options for typescript #17710

hyperion-cs opened this issue Dec 18, 2024 · 0 comments
Labels
area/components area/typescript bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/vite-plugin Bugs related to Vite usage with Quasar kind/bug 🐞 Qv2 🔝 Quasar v2 issues

Comments

@hyperion-cs
Copy link

What happened?

When using the QOptionGroup component and options in conjunction with option-value/option-label (options list items have different field names than value/label), a typescript type checking error occurs, e.g.:

Type '{ id: number; name: string; }[]' is not assignable to type '{ [props: string]: any; label: string; value: any; disable?: boolean | undefined; }[]'.

What did you expect to happen?

I expect that it's possible to put a list of any objects into options, as is implemented e.g. in QSelect.

Reproduction URL

https://stackblitz.com/edit/vite-cywbftpt?file=src%2FApp.vue

How to reproduce?

<script setup lang="ts">
  import { ref } from 'vue'
  const mod = ref([])
  const opts = [{ id: 1, name: 'foo' }, { id: 2, name: 'bar' }]
</script>

<template>
  <q-option-group v-model="mod" :options="opts" option-value="id" option-label="name" />
</template>

Flavour

Vite Plugin (@quasar/vite-plugin)

Areas

Components (quasar), TypeScript Support

Platforms/Browsers

No response

Quasar info output

No response

Relevant log output

No response

Additional context

In fact it works in a dev environment, it's just the options have the wrong type.

@github-actions github-actions bot added area/components area/typescript bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/vite-plugin Bugs related to Vite usage with Quasar labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/components area/typescript bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/vite-plugin Bugs related to Vite usage with Quasar kind/bug 🐞 Qv2 🔝 Quasar v2 issues
Projects
None yet
Development

No branches or pull requests

1 participant