Do not report errors when inference is partially blocked (#52728)

This commit is contained in:
Mateusz Burzyński
2023-02-17 00:17:07 +01:00
committed by GitHub
parent 4b534dc859
commit 879dbcd2df
4 changed files with 52 additions and 1 deletions

View File

@@ -1427,6 +1427,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
let inlineLevel = 0;
let currentNode: Node | undefined;
let varianceTypeParameter: TypeParameter | undefined;
let isInferencePartiallyBlocked = false;
const emptySymbols = createSymbolTable();
const arrayVariances = [VarianceFlags.Covariant];
@@ -1839,7 +1840,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
toMarkSkip = toMarkSkip.parent;
} while (toMarkSkip && toMarkSkip !== containingCall);
}
isInferencePartiallyBlocked = true;
const result = runWithoutResolvedSignatureCaching(node, fn);
isInferencePartiallyBlocked = false;
if (containingCall) {
let toMarkSkip = node!;
do {
@@ -32667,7 +32672,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
const isTaggedTemplate = node.kind === SyntaxKind.TaggedTemplateExpression;
const isDecorator = node.kind === SyntaxKind.Decorator;
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
const reportErrors = !candidatesOutArray;
const reportErrors = !isInferencePartiallyBlocked && !candidatesOutArray;
let typeArguments: NodeArray<TypeNode> | undefined;