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

Method checkConditionalExpression

internal/checker/checker.go:10908–10915  ·  view source on GitHub ↗
(node *ast.Node, checkMode CheckMode)

Source from the content-addressed store, hash-verified

10906}
10907
10908func (c *Checker) checkConditionalExpression(node *ast.Node, checkMode CheckMode) *Type {
10909 cond := node.AsConditionalExpression()
10910 t := c.checkTruthinessExpression(cond.Condition, checkMode)
10911 c.checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(cond.Condition, t, cond.WhenTrue)
10912 type1 := c.checkExpressionEx(cond.WhenTrue, checkMode)
10913 type2 := c.checkExpressionEx(cond.WhenFalse, checkMode)
10914 return c.getUnionTypeEx([]*Type{type1, type2}, UnionReductionSubtype, nil, nil)
10915}
10916
10917func (c *Checker) checkTruthinessExpression(node *ast.Node, checkMode CheckMode) *Type {
10918 return c.checkTruthinessOfType(c.checkExpressionEx(node, checkMode), node)

Callers 1

checkExpressionWorkerMethod · 0.95

Tested by

no test coverage detected