Replies: 1 comment
-
The problem comes from table/packages/table-core/src/features/ColumnFiltering.ts Lines 189 to 195 in ab2819c FilterFns it'll be not never and filterFns will be required. I wonder why it is enforced once augmented?
A possible solution is to augment a bit further by overwriting declare module '@tanstack/table-core' {
interface FilterFns {
fuzzy: FilterFn<unknown>;
}
interface ColumnFiltersOptions<TData extends RowData> {
filterFns?: Record<string, FilterFn<TData>>;
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey everyone. This library has been an incredible time saver for me, but I've run against an issue I can't find a great solution for.
In the example for filtering a table what appears to be the recommended way of adding custom FilterFns in typescript is to use a variation of the following code:
This works well when I have a single react table instance in my code base, but when I have another instance I find the
useReactTable
hook now globally requires a filterFns option with those same custom filters defined, even when I have no use for those custom filters in another table.After some searching I have given up and type the custom filter as
any
in myColumnDef
's to be done with it. This is obviously not ideal for type safety, so I'm wondering has anyone else encountered this issue? Are there any alternatives to declare module for table-core? I've tried looking into the source code but can't find any obvious way of doing it in locally scoped way.Thanks in advance to all who might help me find a better solution.
Beta Was this translation helpful? Give feedback.
All reactions