fixedColumns() not resolvable with 3.1.1
fixedColumns() not resolvable with 3.1.1
sebastianbarth
Posts: 70Questions: 14Answers: 0
Hi again Allan,
Using Datatables 3.1.1 I have trouble accessing the fixedColumns() method (no problem with DT 2.3.8).
"datatables.net": "3.1.1"
"datatables.net-dt": "3.1.1"
"datatables.net-fixedcolumns": "6.1.0"
"datatables.net-scroller": "3.1.0"
"datatables.net-scroller-dt": "3.1.0"
...
"typescript": "6.0.3"
import 'datatables.net-fixedcolumns';
const dataTable: Api<BaseTableRowData> = ...;
dataTable.fixedColumns().left(columnCount); // Fails with following error
TS2339: Property fixedColumns does not exist on type Api<BaseTableRowData>
Anything wrong with my setup or did the augmentation of the API by the fixed column plugin break?
Any idea?
I use Intellij Ultimate (contains Webstorm).
Cheers
Sebastian
Answers
Hi Sebastian,
You are absolutely right - that's a bug on my part. I hadn't correctly extended the DataTables Api interface. I've corrected that and I'll do a patch release, possibly tomorrow all being well to address this. I've checked over the other extensions and they are all fine - just FixedColumns!
Allan
Awesome, thanks!
I just noticed that it is not necessary to have both, the normal and "-dt" dependencies.
With
3.1.2and fixedcolumns at6.1.1I still have the issue:Is there anything wrong on my side?
I've just tried it here: https://stackblitz.com/edit/uwusqjsh?file=src%2Fmain.ts%2Cindex.html . It seems to be working as expected.
Are you able to link to a minimal test repo showing the issue, or a StackBlitz example showing it?
Allan
The problem is not that the fixedColumns() is missing. It is just not visible to TS. At runtime it is there.
What online platform could I use to reproduce this TS issue - What would be the best for you?
Greetings
Sebastian
Hi Sebastian,
StackBlitz will show TS errors (compile and runtime) - I've updated the example blitz I posted before to use a property that doesn't exist and it correctly shows an error:
Indeed, hovering over the
.fixedColumns()part correctly shows the TS comment information.If the error can't be reproduced on StackBlitz, you could use a minimal git repo perhaps?
Allan
Thanks Allan, I indeed had a stale node_modules state, although I can't explain how it could ended up like this.
Sorry for the trouble!
Seems all fine now, with the fixedColumns API method and config option, now.
Not a problem at all. Glad it is sorted
Allan