Typescript problems with layout functions
Typescript problems with layout functions

I am converting an existing project to typescript modules. Previously I lazily just had DataTable defined as any; now I am importing datatables.net-bs5, etc. (version 2.2.2).
I'm having problems with typescript errors on layout parameters that are functions.
layout: {
topStart: function () {...}
}
is giving the following typescript error:
Type '() => HTMLDivElement' is not assignable to type 'LayoutElement | LayoutFeatures | null | undefined'
None of those types in datatables.net/types/types.d.ts file strike me as mapping to a function, but sometimes those can be hard to parse.
Am I missing a dependency or a particular tsconfig setting?
Answers
Apologies - that's my error. I hadn't included that option in the types. I've committed a change for that now. You could make that change in your local copy if you want to use it immediately. Alternatively, use
as any
to take the brutal approach. DataTables 2.3 with the change will be shipped by the end of the month.Allan
Thanks. I patched my local copy and it worked. Thank you!