TypeScript: layout.features rejects mixed strings and configuration objects
TypeScript: layout.features rejects mixed strings and configuration objects
in DataTables
Link to test case: https://stackblitz.com/edit/vitejs-vite-mzsu84ci?file=src%2Fmain.ts&terminal=dev
Hi,
I'm using DataTables 3.1.4 with TypeScript.
The documentation describes features as an array accepting feature strings and configuration objects. However, mixing both in the same array produces a TypeScript error.
import type { Options } from 'datatables.net-dt';
const config: Options = {
layout: {
top1: {
features: ['search', { div: {} }],
},
},
};
The configuration works at runtime, and replacing search with { search: {} } resolves the type error.
This question has an accepted answers - jump to answer
Answers
Again thank you
. I've committed this fix to address the error. It will also be in the next patch release.
Allan