tyneq / isSourceNode
Function: isSourceNode()
isSourceNode(
node):node is IQueryNode & { sourceKind: SourceKind }
Defined in: src/types/queryplan.ts:90
Narrows a QueryPlanNode to one that is guaranteed to have a sourceKind.
Parameters
| Parameter | Type |
|---|---|
node | IQueryNode |
Returns
node is IQueryNode & { sourceKind: SourceKind }
Remarks
sourceKind is only present on source nodes (category === "source"). Reading it on any other node returns undefined. Use this guard before accessing node.sourceKind to get proper type narrowing and avoid ambiguous undefined.
Example
ts
if (isSourceNode(node)) {
console.log(node.sourceKind); // "array" | "set" | "map" | "string" | "other"
}