Skip to content

Type Editor


Type Editor / @type-editor/tables / utils/query / isCellSelection

Function: isCellSelection()

ts
function isCellSelection(value): value is CellSelection;

Defined in: tables/src/utils/query.ts:70

Type guard to check if a value is a CellSelection instance.

This function safely determines whether an unknown value is a cell selection, enabling type-safe access to cell selection properties and methods.

Parameters

ParameterTypeDescription
valueunknownThe value to check.

Returns

value is CellSelection

true if the value is a CellSelection instance, false otherwise.

Example

typescript
if (isCellSelection(editor.state.selection)) {
  const anchorCell = editor.state.selection.$anchorCell;
  const headCell = editor.state.selection.$headCell;
}