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

Method getOptionalExpressionType

internal/checker/checker.go:28821–28830  ·  view source on GitHub ↗
(exprType *Type, expression *ast.Node)

Source from the content-addressed store, hash-verified

28819}
28820
28821func (c *Checker) getOptionalExpressionType(exprType *Type, expression *ast.Node) *Type {
28822 switch {
28823 case ast.IsExpressionOfOptionalChainRoot(expression):
28824 return c.GetNonNullableType(exprType)
28825 case ast.IsOptionalChain(expression):
28826 return c.removeOptionalTypeMarker(exprType)
28827 default:
28828 return exprType
28829 }
28830}
28831
28832func (c *Checker) removeOptionalTypeMarker(t *Type) *Type {
28833 if c.strictNullChecks {

Calls 4

GetNonNullableTypeMethod · 0.95
IsOptionalChainFunction · 0.92

Tested by

no test coverage detected