diff --git a/server/src/analyzer/typeEvaluator.ts b/server/src/analyzer/typeEvaluator.ts index 359670233215..4bf89cc6add6 100644 --- a/server/src/analyzer/typeEvaluator.ts +++ b/server/src/analyzer/typeEvaluator.ts @@ -3239,12 +3239,14 @@ export function createTypeEvaluator(importLookup: ImportLookup): TypeEvaluator { errorNode); } } - } - type = validateCallArguments(errorNode, argList, functionType, - new TypeVarMap(), skipUnknownArgCheck).returnType; - if (!type) { - type = UnknownType.create(); + type = convertClassToObject(castToType); + } else { + type = validateCallArguments(errorNode, argList, functionType, + new TypeVarMap(), skipUnknownArgCheck).returnType; + if (!type) { + type = UnknownType.create(); + } } } else { const exprString = ParseTreeUtils.printExpression(errorNode);