Custom sorting in @tanstack/react-table v8

117 Views Asked by At

I have a problem with declaring custom sort types.The documentation states the declaration as follows:

declare module '@tanstack/table-core' {
    interface SortingFns {
       myCustomSorting: SortingFn<unknown>
     }
}

I did this in an external .d.ts file. But now this property has become mandatory and must now be specified in useReactTable.

const instance = useReactTable(
    {
        data,
        columns,
        getCoreRowModel: getCoreRowModel(),
        sortingFns: {}
    }
)

Can I somehow declare it so that it is optional?

0

There are 0 best solutions below