@@ -1265,11 +1265,10 @@ export const enum CheckMode {
1265
1265
SkipContextSensitive = 1 << 2, // Skip context sensitive function expressions
1266
1266
SkipGenericFunctions = 1 << 3, // Skip single signature generic functions
1267
1267
IsForSignatureHelp = 1 << 4, // Call resolution for purposes of signature help
1268
- IsForStringLiteralArgumentCompletions = 1 << 5, // Do not infer from the argument currently being typed
1269
- RestBindingElement = 1 << 6, // Checking a type that is going to be used to determine the type of a rest binding element
1268
+ RestBindingElement = 1 << 5, // Checking a type that is going to be used to determine the type of a rest binding element
1270
1269
// e.g. in `const { a, ...rest } = foo`, when checking the type of `foo` to determine the type of `rest`,
1271
1270
// we need to preserve generic types instead of substituting them for constraints
1272
- TypeOnly = 1 << 7 , // Called from getTypeOfExpression, diagnostics may be omitted
1271
+ TypeOnly = 1 << 6 , // Called from getTypeOfExpression, diagnostics may be omitted
1273
1272
}
1274
1273
1275
1274
/** @internal */
@@ -1841,7 +1840,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1841
1840
const candidates: Signature[] = [];
1842
1841
1843
1842
// first, get candidates when inference is blocked from the source node.
1844
- runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(call, candidates, /*argumentCount*/ undefined, CheckMode.IsForStringLiteralArgumentCompletions ));
1843
+ runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(call, candidates, /*argumentCount*/ undefined, CheckMode.Normal ));
1845
1844
for (const candidate of candidates) {
1846
1845
candidatesSet.add(candidate);
1847
1846
}
@@ -25010,7 +25009,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
25010
25009
if (!couldContainTypeVariables(target)) {
25011
25010
return;
25012
25011
}
25013
- if (source === wildcardType) {
25012
+ if (source === wildcardType || source === blockedStringType ) {
25014
25013
// We are inferring from an 'any' type. We want to infer this type for every type parameter
25015
25014
// referenced in the target type, so we record it as the propagation type and infer from the
25016
25015
// target to itself. Then, as we find candidates we substitute the propagation type.
@@ -25110,14 +25109,17 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
25110
25109
return;
25111
25110
}
25112
25111
if (!inference.isFixed) {
25112
+ const candidate = propagationType || source;
25113
+ if (candidate === blockedStringType) {
25114
+ return;
25115
+ }
25113
25116
if (inference.priority === undefined || priority < inference.priority) {
25114
25117
inference.candidates = undefined;
25115
25118
inference.contraCandidates = undefined;
25116
25119
inference.topLevel = true;
25117
25120
inference.priority = priority;
25118
25121
}
25119
25122
if (priority === inference.priority) {
25120
- const candidate = propagationType || source;
25121
25123
// We make contravariant inferences only if we are in a pure contravariant position,
25122
25124
// i.e. only if we have not descended into a bivariant position.
25123
25125
if (contravariant && !bivariant) {
@@ -25850,7 +25852,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
25850
25852
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
25851
25853
if (constraint) {
25852
25854
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
25853
- if (!inferredType || inferredType === blockedStringType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
25855
+ if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
25854
25856
// If the fallback type satisfies the constraint, we pick it. Otherwise, we pick the constraint.
25855
25857
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
25856
25858
}
@@ -33284,7 +33286,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
33284
33286
33285
33287
for (let i = 0; i < argCount; i++) {
33286
33288
const arg = args[i];
33287
- if (arg.kind !== SyntaxKind.OmittedExpression && !(checkMode & CheckMode.IsForStringLiteralArgumentCompletions && hasSkipDirectInferenceFlag(arg)) ) {
33289
+ if (arg.kind !== SyntaxKind.OmittedExpression) {
33288
33290
const paramType = getTypeAtPosition(signature, i);
33289
33291
if (couldContainTypeVariables(paramType)) {
33290
33292
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -33934,7 +33936,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
33934
33936
// decorators are applied to a declaration by the emitter, and not to an expression.
33935
33937
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
33936
33938
let argCheckMode = !isDecorator && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? CheckMode.SkipContextSensitive : CheckMode.Normal;
33937
- argCheckMode |= checkMode & CheckMode.IsForStringLiteralArgumentCompletions;
33938
33939
33939
33940
// The following variables are captured and modified by calls to chooseOverload.
33940
33941
// If overload resolution or type argument inference fails, we want to report the
0 commit comments