6pac / SlickGrid

A lightning fast JavaScript grid/spreadsheet
https://stackblitz.com/github/6pac/SlickGrid/tree/master/vite-demo
MIT License
1.84k stars 422 forks source link

Cannot set selectionModel #927

Closed b-giavotto closed 11 months ago

b-giavotto commented 11 months ago

this typescript code fails:

    let sm = new Slick.SlickRowSelectionModel();

    grid.setSelectionModel(sm);

the typescript compiler complain about incompatibility between Slick.SlickRowSelectionModel and the declared prototype of setSelectionModel found in slick.grid.ts

setSelectionModel(model: SelectionModel) { if (this.selectionModel) { this.selectionModel.onSelectedRangesChanged.unsubscribe(this.handleSelectedRangesChanged.bind(this)); if (this.selectionModel.destroy) { this.selectionModel.destroy(); } }

Compiler output:

TS2345: Argument of type 'SlickRowSelectionModel' is not assignable to parameter of type 'SelectionModel'. Type 'SlickRowSelectionModel' is not assignable to type '{ refreshSelections: () => void; onSelectedRangesChanged: SlickEvent<SlickRange[]>; getSelectedRanges: () => SlickRange[]; setSelectedRanges: (ranges: SlickRange[], caller?: string) => void; }'. Types of property 'onSelectedRangesChanged' are incompatible. Type 'SlickEvent<CellRange[]>' is not assignable to type 'SlickEvent<SlickRange[]>'. Type 'CellRange[]' is not assignable to type 'SlickRange[]'. Type 'CellRange' is missing the following properties from type 'SlickRange': isSingleRow, isSingleCell, contains

ghiscoding commented 11 months ago

it should be fixed in v5.5.5... high five ✋🏻