onCellsChanged typeerror following "Handling Data Changes"
Bijig0 opened this issue · comments
Describe the bug
A clear and concise description of what the bug is.
When following the docs https://reactgrid.com/docs/4.0/2-implementing-core-features/1-handling-changes/, I am getting the type error when assigning handleChanges
to onChange
No overload matches this call.
Overload 1 of 2, '(props: ReactGridProps | Readonly<ReactGridProps>): ReactGrid', gave the following error.
Type '(changes: CellChange<TextCell>[]) => void' is not assignable to type '(cellChanges: ({ readonly rowId: Id; readonly columnId: Id; readonly type: "checkbox"; readonly previousCell: CheckboxCell & Cell; readonly newCell: CheckboxCell & Cell; } | ... 7 more ... | { ...; })[]) => void'.
Types of parameters 'changes' and 'cellChanges' are incompatible.
Type '({ readonly rowId: Id; readonly columnId: Id; readonly type: "checkbox"; readonly previousCell: CheckboxCell & Cell; readonly newCell: CheckboxCell & Cell; } | ... 7 more ... | { ...; })[]' is not assignable to type '{ readonly rowId: Id; readonly columnId: Id; readonly type: "text"; readonly previousCell: TextCell; readonly newCell: TextCell; }[]'.
Type '{ readonly rowId: Id;
Current behavior
A clear and concise description of what you current see.
Type Error
Expected behavior
A clear and concise description of what you expected to happen.
No type error
Screenshots or gifs
If applicable, add screenshots to help explain your problem.
Your environment details
Chrome desktop
Describe the bug A clear and concise description of what the bug is. When following the docs https://reactgrid.com/docs/4.0/2-implementing-core-features/1-handling-changes/, I am getting the type error when assigning
handleChanges
toonChange
No overload matches this call. Overload 1 of 2, '(props: ReactGridProps | Readonly<ReactGridProps>): ReactGrid', gave the following error. Type '(changes: CellChange<TextCell>[]) => void' is not assignable to type '(cellChanges: ({ readonly rowId: Id; readonly columnId: Id; readonly type: "checkbox"; readonly previousCell: CheckboxCell & Cell; readonly newCell: CheckboxCell & Cell; } | ... 7 more ... | { ...; })[]) => void'. Types of parameters 'changes' and 'cellChanges' are incompatible. Type '({ readonly rowId: Id; readonly columnId: Id; readonly type: "checkbox"; readonly previousCell: CheckboxCell & Cell; readonly newCell: CheckboxCell & Cell; } | ... 7 more ... | { ...; })[]' is not assignable to type '{ readonly rowId: Id; readonly columnId: Id; readonly type: "text"; readonly previousCell: TextCell; readonly newCell: TextCell; }[]'. Type '{ readonly rowId: Id;
Current behavior A clear and concise description of what you current see. Type Error
Expected behavior A clear and concise description of what you expected to happen. No type error
Screenshots or gifs If applicable, add screenshots to help explain your problem.
**Your environment details**Chrome desktop
An error might mean something like this: your function only handles TextCell type changes, but your component needs a function that handles changes including CheckboxCell and many other types.