diff --git a/packages/pyright-internal/src/analyzer/operations.ts b/packages/pyright-internal/src/analyzer/operations.ts index fceccba4a455..d71c582b19d7 100644 --- a/packages/pyright-internal/src/analyzer/operations.ts +++ b/packages/pyright-internal/src/analyzer/operations.ts @@ -1198,7 +1198,7 @@ function validateContainmentOperation( deprecatedInfo = returnTypeResult.magicMethodDeprecationInfo; } - return returnTypeResult?.type; + return returnTypeResult?.type ?? evaluator.getBuiltInObject(errorNode, 'bool'); } ); }