-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
:displayValue="(person) => person.name"; Object is of type 'unknown'.ts(2571) #1332
Comments
@StefanGhiban , I ran into the same issue - how did you get it solved? |
@flutcon due to the function taking an unknown argument as input, I have used a type assertion as following:
Test being an interface with key, label and values as attributes. |
@StefanGhiban this does not work in vue |
The solution proposed is not working on Vue too |
@faithfulojebiyi @srisar It worked fine for me. Do you have a solution or a workaround for this issue? |
If you are using this directly in the template it would work out of the box in Vue 3 because it parses templates for typescript. For Vue 2 you should reference a function in the template function displayValue(value: unknown) {
return (value as YourType)?.someProp ?? ''
} |
:display-value="(person: any) => person.value" For me works 🤔 |
actual bug btw |
What package within Headless UI are you using?
@headlessui/vue
What version of that package are you using?
1.5.0
What browser are you using?
Chrome
Describe your issue
The comboxbox input attribute displayValue has a signature of "displayValue?: ((item: unknown) => string) | undefined", which throws an error in vue with ts. We can't access a property of an object that has type unknown.
The text was updated successfully, but these errors were encountered: