TypeScript: search property missing from search options
TypeScript: search property missing from search options
in DataTables
Link to test case: https://stackblitz.com/edit/vitejs-vite-jtnwxou1?file=src%2Fmain.ts&terminal=dev
Hi,
I'm using DataTables 3.1.4 with TypeScript.
Both the searchCols documentation and the columns.search documentation show a search property for configuring a column search.
However, both configurations below produce a TypeScript error because search is missing from SearchOptions:
import type { Options } from 'datatables.net-dt';
const configWithSearchCols: Options = {
searchCols: [
{ search: 'My filter' },
],
};
const configWithColumns: Options = {
columns: [
{ search: { search: () => true } },
],
};
Both configurations work at runtime. Function-valued searches also work at runtime, so the initialisation types should allow those as well.
I understand that searchCols is deprecated in favour of columns.search, but the replacement encounters the same issue.
This question has an accepted answers - jump to answer
Answers
Thank you - I recall getting into a little bit of a fix while writing this part for DataTables 3 and it seems I didn't get it quite right. Completely agree about the error that. I've committed a fix to address the issue.
Regards,
Allan