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]: v-model should infer T or T[] based on multiple value #1308

Open
iamandrewluca opened this issue Sep 20, 2024 · 0 comments · May be fixed by #1309
Open

[Bug]: v-model should infer T or T[] based on multiple value #1308

iamandrewluca opened this issue Sep 20, 2024 · 0 comments · May be fixed by #1309
Labels
bug Something isn't working

Comments

@iamandrewluca
Copy link

iamandrewluca commented Sep 20, 2024

Environment

Developement/Production OS: macOS Sonoma 14.6.1 (23G93)
Node version: v20.17.0
Package manager: 9.4.0
Radix Vue version: 1.9.6
Vue version: 3.5.6
Nuxt version: N/A
Nuxt mode: N/A
Nuxt target: N/A
CSS framework: [email protected]
Client OS: macOS Sonoma 14.6.1 (23G93)
Browser: Chrome Version 129.0.6668.58 (Official Build) (arm64)

Link to minimal reproduction

https://github.com/iamandrewluca/issue-radix-vue-multiple/blob/3b59ed50ec9dda458462c42a7b9f35516e254858/src/App.vue#L20-L22

Steps to reproduce

  • Create a Combobox with prop multiple
  • Have a value of type Array<string>
  • Use value on Combobox using v-model explicit approach (desugared)

Describe the bug

When using Combobox with multiple and having the value typed, and using explicit v-model, a type error occurs

Type 'string' is not assignable to type 'string[]'.ts-plugin(2322)

It is strange why when using v-model directly this error is ignored

Expected behavior

Depending on the value passed to the multiple prop, the Combobox should infer the type of $event emitted by @update:model-value event

A better approach would be to infer the $event type from the type of modelValue

Context & Screenshots (if applicable)

I started a draft MR, but not sure how exactly to test the types
#1309

image
@iamandrewluca iamandrewluca added the bug Something isn't working label Sep 20, 2024
@zernonia zernonia linked a pull request Sep 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant