MCPcopy Create free account
hub / github.com/microsoft/typescript-go / IsExpressionOfOptionalChainRoot

Function IsExpressionOfOptionalChainRoot

internal/ast/utilities.go:383–385  ·  view source on GitHub ↗

Determines whether a node is the expression preceding an optional chain (i.e. `a` in `a?.b`).

(node *Node)

Source from the content-addressed store, hash-verified

381
382// Determines whether a node is the expression preceding an optional chain (i.e. `a` in `a?.b`).
383func IsExpressionOfOptionalChainRoot(node *Node) bool {
384 return IsOptionalChainRoot(node.Parent) && node.Parent.Expression() == node
385}
386
387func IsNullishCoalesce(node *Node) bool {
388 return node.Kind == KindBinaryExpression && node.AsBinaryExpression().OperatorToken.Kind == KindQuestionQuestionToken

Callers 3

narrowTypeMethod · 0.92
createFlowConditionMethod · 0.92

Calls 2

IsOptionalChainRootFunction · 0.85
ExpressionMethod · 0.80

Tested by

no test coverage detected