-
Notifications
You must be signed in to change notification settings - Fork 358
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]: typecheck bug on the DataTableFacetedFilter example #327
Comments
@maelp can you hover over underlined red text and show error too, please) |
thanks, will take a look on it) |
BTW adding ":string" to term doesn't fix the bug for me (taking a look at your PR) |
Yes, it just little issue so never mind, I will remove |
@maelp To fix this issue you need to define ![]() ![]() ![]() Need to think about how to fix it globally, because issue is inside radix-vue components, when you don't define export type AcceptableValue = string | number | boolean | object; It's logical that Will try to think with it, maybe need to fix radix-vue TS types 🤔 @sadeghbarati maybe you will look and have some ideas, I will appreciate it ❤️ |
Interesting... indeed I didn't know whether the issue was that the method is expecting any AcceptableValue and typescript is complaining that we are only handling the case where the filterFunction parameter is of type |
No, issue is that typescript don't think that our custom object for option is In my codebase I never use |
I'm also getting the same issue... export type FilterItem = {
value: string;
label: string;
};
const onSift = (list: FilterItem[], term: string) => {
return list.filter(item => item.label.toLowerCase().includes(term.toLowerCase()));
};
Diagnostics:
1. Type '(list: FilterItem[], term: string) => globalThis.FilterItem[]' is not assignable to type '(val: string[] | number[] | false[] | true[] | Record<string, any>[], term: string) => string[] | number[] | false[] | true[] | Record<string, any>[]'. [2322] |
@romanhrynevych so is the other part of this solution commenting out
|
This fixed the error for me. In types/index.d.ts
In Command.vue
In FacetedFilter.vue (or wherever you define your filters)
|
Reproduction
None
Describe the bug
When using the code from the Task table example DataTableFacetedFilter I have the following issue
I'm using the latest radix-vue, but it seems that filter-function first parameter should use "AcceptableValue[]" list, which contains string, number, object etc, but it doesn't typecheck for an arbitrary object for some reason(?)
System Info
Contributes
The text was updated successfully, but these errors were encountered: