TypeScript: colReorder: true is rejected by Options in DataTables 3.x
TypeScript: colReorder: true is rejected by Options in DataTables 3.x
Link to test case: https://stackblitz.com/edit/vitejs-vite-yyaf782f?file=src%2Fmain.ts
Hi,
I'm using DataTables 3.0.2 with ColReorder 3.0.1 and TypeScript 5.9.3.
The documented initialization syntax allows colReorder to be a boolean:
new DataTable('#example', {
colReorder: true
});
However, when the config object is typed as Options, TypeScript rejects true:
import DataTable from 'datatables.net-dt';
import 'datatables.net-colreorder-dt';import type { Options } from 'datatables.net-dt';
const config: Options = {
colReorder: true
};
The Typescript error is:
Type boolean has no properties in common with type '...'
My understanding is that the initialization option should accept:
boolean | ConfigColReorder
but through the current Options type it seems to resolve to only ConfigColReorder.
Expected behavior: colReorder: true should be accepted by TypeScript, since it is a documented and supported initialization value.
Actual behavior: TypeScript reports that boolean is not assignable to ConfigColReorder.