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

Closed
hyperion-cs opened this issue Dec 18, 2024 · 1 comment
Closed

QOptionGroup invalid type of options for typescript #17710

hyperion-cs opened this issue Dec 18, 2024 · 1 comment
Assignees
Labels
area/components area/typescript bug/2-confirmed We have reproduce the problem and confirmed that this is a bug. 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
yusufkandemir added a commit to yusufkandemir/quasar that referenced this issue Jan 14, 2025
to respect option-label and option-value props
@yusufkandemir yusufkandemir added bug/2-confirmed We have reproduce the problem and confirmed that this is a bug. and removed bug/1-repro-available A reproduction is available and needs to be confirmed. labels Jan 14, 2025
@yusufkandemir yusufkandemir self-assigned this Jan 14, 2025
@rstoenescu
Copy link
Member

Fix will be available in Quasar v2.17.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/components area/typescript bug/2-confirmed We have reproduce the problem and confirmed that this is a bug. flavour/vite-plugin Bugs related to Vite usage with Quasar kind/bug 🐞 Qv2 🔝 Quasar v2 issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants