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

Method checkTestingKnownTruthyTypes

internal/checker/checker.go:3807–3814  ·  view source on GitHub ↗
(condExpr *ast.Node, condType *Type, body *ast.Node)

Source from the content-addressed store, hash-verified

3805}
3806
3807func (c *Checker) checkTestingKnownTruthyTypes(condExpr *ast.Node, condType *Type, body *ast.Node) {
3808 condExpr = ast.SkipParentheses(condExpr)
3809 c.checkTestingKnownTruthyType(condExpr, condType, body)
3810 for ast.IsBinaryExpression(condExpr) && (condExpr.AsBinaryExpression().OperatorToken.Kind == ast.KindBarBarToken || condExpr.AsBinaryExpression().OperatorToken.Kind == ast.KindQuestionQuestionToken) {
3811 condExpr = ast.SkipParentheses(condExpr.AsBinaryExpression().Left)
3812 c.checkTestingKnownTruthyType(condExpr, condType, body)
3813 }
3814}
3815
3816func (c *Checker) checkTestingKnownTruthyType(condExpr *ast.Node, condType *Type, body *ast.Node) {
3817 location := condExpr

Calls 4

SkipParenthesesFunction · 0.92
IsBinaryExpressionFunction · 0.92
AsBinaryExpressionMethod · 0.80

Tested by

no test coverage detected