isOmitted

tcmts.core.ts.isOmitted · #ybiwpghv · term · runs anywhere

A hole in an array pattern, [, x]: an omitted expression, or (as TypeScript 7 parses it) a binding element with no name.

import { SyntaxKind } from "typescript/ast";
import type { Node } from "typescript/ast";

export const isOmitted = (node: Node): boolean => node.kind === SyntaxKind.OmittedExpression || (node.kind === SyntaxKind.BindingElement && !(node as { name?: Node }).name)

used by