@typescript-deploys/pr-build 5.2.0-pr-54316-2 → 5.2.0-pr-54052-23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,3 +22,4 @@ and limitations under the License.
22
22
  /// <reference lib="es2017.string" />
23
23
  /// <reference lib="es2017.intl" />
24
24
  /// <reference lib="es2017.typedarrays" />
25
+ /// <reference lib="es2017.date" />
@@ -0,0 +1,31 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+
17
+ /// <reference no-default-lib="true"/>
18
+
19
+ interface DateConstructor {
20
+ /**
21
+ * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.
22
+ * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.
23
+ * @param monthIndex The month as a number between 0 and 11 (January to December).
24
+ * @param date The date as a number between 1 and 31.
25
+ * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.
26
+ * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.
27
+ * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.
28
+ * @param ms A number from 0 to 999 that specifies the milliseconds.
29
+ */
30
+ UTC(year: number, monthIndex?: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;
31
+ }
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.2";
21
- var version = `${versionMajorMinor}.0-insiders.20230518`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230526`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -33368,6 +33368,7 @@ var libEntries = [
33368
33368
  ["es2015.symbol", "lib.es2015.symbol.d.ts"],
33369
33369
  ["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
33370
33370
  ["es2016.array.include", "lib.es2016.array.include.d.ts"],
33371
+ ["es2017.date", "lib.es2017.date.d.ts"],
33371
33372
  ["es2017.object", "lib.es2017.object.d.ts"],
33372
33373
  ["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
33373
33374
  ["es2017.string", "lib.es2017.string.d.ts"],
@@ -42655,6 +42656,7 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
42655
42656
  CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
42656
42657
  CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
42657
42658
  CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
42659
+ CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
42658
42660
  return CheckMode3;
42659
42661
  })(CheckMode || {});
42660
42662
  var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
@@ -47901,32 +47903,34 @@ function createTypeChecker(host) {
47901
47903
  const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
47902
47904
  typeElements.push(preserveCommentsOn(methodDeclaration));
47903
47905
  }
47906
+ if (signatures.length || !optionalToken) {
47907
+ return;
47908
+ }
47909
+ }
47910
+ let propertyTypeNode;
47911
+ if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
47912
+ propertyTypeNode = createElidedInformationPlaceholder(context);
47904
47913
  } else {
47905
- let propertyTypeNode;
47906
- if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
47907
- propertyTypeNode = createElidedInformationPlaceholder(context);
47908
- } else {
47909
- if (propertyIsReverseMapped) {
47910
- context.reverseMappedStack || (context.reverseMappedStack = []);
47911
- context.reverseMappedStack.push(propertySymbol);
47912
- }
47913
- propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
47914
- if (propertyIsReverseMapped) {
47915
- context.reverseMappedStack.pop();
47916
- }
47914
+ if (propertyIsReverseMapped) {
47915
+ context.reverseMappedStack || (context.reverseMappedStack = []);
47916
+ context.reverseMappedStack.push(propertySymbol);
47917
47917
  }
47918
- const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
47919
- if (modifiers) {
47920
- context.approximateLength += 9;
47918
+ propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
47919
+ if (propertyIsReverseMapped) {
47920
+ context.reverseMappedStack.pop();
47921
47921
  }
47922
- const propertySignature = factory.createPropertySignature(
47923
- modifiers,
47924
- propertyName,
47925
- optionalToken,
47926
- propertyTypeNode
47927
- );
47928
- typeElements.push(preserveCommentsOn(propertySignature));
47929
47922
  }
47923
+ const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
47924
+ if (modifiers) {
47925
+ context.approximateLength += 9;
47926
+ }
47927
+ const propertySignature = factory.createPropertySignature(
47928
+ modifiers,
47929
+ propertyName,
47930
+ optionalToken,
47931
+ propertyTypeNode
47932
+ );
47933
+ typeElements.push(preserveCommentsOn(propertySignature));
47930
47934
  function preserveCommentsOn(node) {
47931
47935
  var _a2;
47932
47936
  if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
@@ -53989,7 +53993,7 @@ function createTypeChecker(host) {
53989
53993
  } else if (type !== firstType) {
53990
53994
  checkFlags |= 64 /* HasNonUniformType */;
53991
53995
  }
53992
- if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) {
53996
+ if (isLiteralType(type) || isPatternLiteralType(type)) {
53993
53997
  checkFlags |= 128 /* HasLiteralType */;
53994
53998
  }
53995
53999
  if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) {
@@ -56216,31 +56220,28 @@ function createTypeChecker(host) {
56216
56220
  return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
56217
56221
  }
56218
56222
  function getUnionOrIntersectionTypePredicate(signatures, kind) {
56219
- let first2;
56223
+ let last2;
56220
56224
  const types = [];
56221
56225
  for (const sig of signatures) {
56222
56226
  const pred = getTypePredicateOfSignature(sig);
56223
- if (!pred || pred.kind === 2 /* AssertsThis */ || pred.kind === 3 /* AssertsIdentifier */) {
56224
- if (kind !== 2097152 /* Intersection */) {
56225
- continue;
56226
- } else {
56227
- return;
56228
- }
56229
- }
56230
- if (first2) {
56231
- if (!typePredicateKindsMatch(first2, pred)) {
56227
+ if (pred) {
56228
+ if (pred.kind !== 0 /* This */ && pred.kind !== 1 /* Identifier */ || last2 && !typePredicateKindsMatch(last2, pred)) {
56232
56229
  return void 0;
56233
56230
  }
56231
+ last2 = pred;
56232
+ types.push(pred.type);
56234
56233
  } else {
56235
- first2 = pred;
56234
+ const returnType = kind !== 2097152 /* Intersection */ ? getReturnTypeOfSignature(sig) : void 0;
56235
+ if (returnType !== falseType && returnType !== regularFalseType) {
56236
+ return void 0;
56237
+ }
56236
56238
  }
56237
- types.push(pred.type);
56238
56239
  }
56239
- if (!first2) {
56240
+ if (!last2) {
56240
56241
  return void 0;
56241
56242
  }
56242
56243
  const compositeType = getUnionOrIntersectionType(types, kind);
56243
- return createTypePredicate(first2.kind, first2.parameterName, first2.parameterIndex, compositeType);
56244
+ return createTypePredicate(last2.kind, last2.parameterName, last2.parameterIndex, compositeType);
56244
56245
  }
56245
56246
  function typePredicateKindsMatch(a, b) {
56246
56247
  return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
@@ -57282,9 +57283,9 @@ function createTypeChecker(host) {
57282
57283
  );
57283
57284
  if (freshMapper) {
57284
57285
  const freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
57285
- for (const p of freshParams) {
57286
- if (root.inferTypeParameters.indexOf(p) === -1) {
57287
- p.mapper = freshCombinedMapper;
57286
+ for (let i = 0; i < freshParams.length; i++) {
57287
+ if (freshParams[i] !== root.inferTypeParameters[i]) {
57288
+ freshParams[i].mapper = freshCombinedMapper;
57288
57289
  }
57289
57290
  }
57290
57291
  }
@@ -58121,18 +58122,19 @@ function createTypeChecker(host) {
58121
58122
  case 185 /* TypeQuery */:
58122
58123
  const entityName = node2.exprName;
58123
58124
  const firstIdentifier = getFirstIdentifier(entityName);
58124
- const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier);
58125
- const tpDeclaration = tp.symbol.declarations[0];
58126
- let tpScope;
58127
- if (tpDeclaration.kind === 167 /* TypeParameter */) {
58128
- tpScope = tpDeclaration.parent;
58129
- } else if (tp.isThisType) {
58130
- tpScope = tpDeclaration;
58131
- } else {
58132
- return true;
58133
- }
58134
- if (firstIdentifierSymbol.declarations) {
58135
- return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference);
58125
+ if (!isThisIdentifier(firstIdentifier)) {
58126
+ const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier);
58127
+ const tpDeclaration = tp.symbol.declarations[0];
58128
+ const tpScope = tpDeclaration.kind === 167 /* TypeParameter */ ? tpDeclaration.parent : (
58129
+ // Type parameter is a regular type parameter, e.g. foo<T>
58130
+ tp.isThisType ? tpDeclaration : (
58131
+ // Type parameter is the this type, and its declaration is the class declaration.
58132
+ void 0
58133
+ )
58134
+ );
58135
+ if (firstIdentifierSymbol.declarations && tpScope) {
58136
+ return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference);
58137
+ }
58136
58138
  }
58137
58139
  return true;
58138
58140
  case 173 /* MethodDeclaration */:
@@ -58186,6 +58188,9 @@ function createTypeChecker(host) {
58186
58188
  const elementFlags = tupleType.target.elementFlags;
58187
58189
  const elementTypes = map(getElementTypes(tupleType), (t, i) => {
58188
58190
  const singleton = elementFlags[i] & 8 /* Variadic */ ? t : elementFlags[i] & 4 /* Rest */ ? createArrayType(t) : createTupleType([t], [elementFlags[i]]);
58191
+ if (singleton === typeVariable) {
58192
+ return mappedType;
58193
+ }
58189
58194
  return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
58190
58195
  });
58191
58196
  const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
@@ -58523,6 +58528,10 @@ function createTypeChecker(host) {
58523
58528
  return true;
58524
58529
  }
58525
58530
  switch (node.kind) {
58531
+ case 233 /* AsExpression */:
58532
+ if (!isConstAssertion(node)) {
58533
+ break;
58534
+ }
58526
58535
  case 293 /* JsxExpression */:
58527
58536
  case 216 /* ParenthesizedExpression */:
58528
58537
  return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer);
@@ -61770,7 +61779,7 @@ function createTypeChecker(host) {
61770
61779
  }
61771
61780
  }
61772
61781
  }
61773
- const filtered = contains(include, 0 /* False */) ? getUnionType(types.filter((_, i) => include[i])) : target;
61782
+ const filtered = contains(include, 0 /* False */) ? getUnionType(types.filter((_, i) => include[i]), 0 /* None */) : target;
61774
61783
  return filtered.flags & 131072 /* Never */ ? target : filtered;
61775
61784
  }
61776
61785
  function isWeakType(type) {
@@ -61974,7 +61983,7 @@ function createTypeChecker(host) {
61974
61983
  }
61975
61984
  function getRecursionIdentity(type) {
61976
61985
  if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) {
61977
- if (getObjectFlags(type) && 4 /* Reference */ && type.node) {
61986
+ if (getObjectFlags(type) & 4 /* Reference */ && type.node) {
61978
61987
  return type.node;
61979
61988
  }
61980
61989
  if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
@@ -64801,7 +64810,7 @@ function createTypeChecker(host) {
64801
64810
  target.antecedents = saveAntecedents;
64802
64811
  } else if (flags & 2 /* Start */) {
64803
64812
  const container = flow.node;
64804
- if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && reference.kind !== 110 /* ThisKeyword */) {
64813
+ if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && !(reference.kind === 110 /* ThisKeyword */ && container.kind !== 218 /* ArrowFunction */)) {
64805
64814
  flow = container.flowNode;
64806
64815
  continue;
64807
64816
  }
@@ -73288,7 +73297,7 @@ function createTypeChecker(host) {
73288
73297
  Debug.assertIsDefined(leftType);
73289
73298
  const rightType = getLastResult(state);
73290
73299
  Debug.assertIsDefined(rightType);
73291
- result = checkBinaryLikeExpressionWorker(node.left, node.operatorToken, node.right, leftType, rightType, node);
73300
+ result = checkBinaryLikeExpressionWorker(node.left, node.operatorToken, node.right, leftType, rightType, state.checkMode, node);
73292
73301
  }
73293
73302
  state.skip = false;
73294
73303
  setLeftType(
@@ -73350,9 +73359,9 @@ function createTypeChecker(host) {
73350
73359
  leftType = checkExpression(left, checkMode);
73351
73360
  }
73352
73361
  const rightType = checkExpression(right, checkMode);
73353
- return checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, errorNode);
73362
+ return checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, checkMode, errorNode);
73354
73363
  }
73355
- function checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, errorNode) {
73364
+ function checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, checkMode, errorNode) {
73356
73365
  const operator = operatorToken.kind;
73357
73366
  switch (operator) {
73358
73367
  case 42 /* AsteriskToken */:
@@ -73509,12 +73518,14 @@ function createTypeChecker(host) {
73509
73518
  case 36 /* ExclamationEqualsToken */:
73510
73519
  case 37 /* EqualsEqualsEqualsToken */:
73511
73520
  case 38 /* ExclamationEqualsEqualsToken */:
73512
- if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
73513
- const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
73514
- error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
73521
+ if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
73522
+ if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
73523
+ const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
73524
+ error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
73525
+ }
73526
+ checkNaNEquality(errorNode, operator, left, right);
73527
+ reportOperatorErrorUnless((left2, right2) => isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2));
73515
73528
  }
73516
- checkNaNEquality(errorNode, operator, left, right);
73517
- reportOperatorErrorUnless((left2, right2) => isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2));
73518
73529
  return booleanType;
73519
73530
  case 104 /* InstanceOfKeyword */:
73520
73531
  return checkInstanceOfExpression(left, right, leftType, rightType);
@@ -73825,7 +73836,7 @@ function createTypeChecker(host) {
73825
73836
  }
73826
73837
  }
73827
73838
  function checkConditionalExpression(node, checkMode) {
73828
- const type = checkTruthinessExpression(node.condition);
73839
+ const type = checkTruthinessExpression(node.condition, checkMode);
73829
73840
  checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue);
73830
73841
  const type1 = checkExpression(node.whenTrue, checkMode);
73831
73842
  const type2 = checkExpression(node.whenFalse, checkMode);
@@ -74166,7 +74177,7 @@ function createTypeChecker(host) {
74166
74177
  }
74167
74178
  }
74168
74179
  const startInvocationCount = flowInvocationCount;
74169
- const type = checkExpression(node);
74180
+ const type = checkExpression(node, 128 /* TypeOnly */);
74170
74181
  if (flowInvocationCount !== startInvocationCount) {
74171
74182
  const cache = flowTypeCache || (flowTypeCache = []);
74172
74183
  cache[getNodeId(node)] = type;
@@ -74242,7 +74253,7 @@ function createTypeChecker(host) {
74242
74253
  if (getIsolatedModules(compilerOptions)) {
74243
74254
  Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
74244
74255
  const constEnumDeclaration = type.symbol.valueDeclaration;
74245
- if (constEnumDeclaration.flags & 16777216 /* Ambient */) {
74256
+ if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
74246
74257
  error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
74247
74258
  }
74248
74259
  }
@@ -74671,6 +74682,9 @@ function createTypeChecker(host) {
74671
74682
  case "length":
74672
74683
  case "caller":
74673
74684
  case "arguments":
74685
+ if (compilerOptions.useDefineForClassFields) {
74686
+ break;
74687
+ }
74674
74688
  case "prototype":
74675
74689
  const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
74676
74690
  const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
@@ -81677,7 +81691,7 @@ function createTypeChecker(host) {
81677
81691
  if (requestedExternalEmitHelperNames.has(name))
81678
81692
  continue;
81679
81693
  requestedExternalEmitHelperNames.add(name);
81680
- const symbol = getSymbol(helpersModule.exports, escapeLeadingUnderscores(name), 111551 /* Value */);
81694
+ const symbol = getSymbol(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */);
81681
81695
  if (!symbol) {
81682
81696
  error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
81683
81697
  } else if (helper & 524288 /* ClassPrivateFieldGet */) {
@@ -118755,7 +118769,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118755
118769
  let filesWithChangedSetOfUnresolvedImports;
118756
118770
  let filesWithInvalidatedResolutions;
118757
118771
  let filesWithInvalidatedNonRelativeUnresolvedImports;
118758
- const nonRelativeExternalModuleResolutions = /* @__PURE__ */ new Set();
118772
+ const nonRelativeExternalModuleResolutions = createMultiMap();
118759
118773
  const resolutionsWithFailedLookups = /* @__PURE__ */ new Set();
118760
118774
  const resolutionsWithOnlyAffectingLocations = /* @__PURE__ */ new Set();
118761
118775
  const resolvedFileToResolution = /* @__PURE__ */ new Map();
@@ -118889,7 +118903,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118889
118903
  moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
118890
118904
  typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
118891
118905
  libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
118892
- watchFailedLookupLocationOfNonRelativeModuleResolutions();
118906
+ nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
118907
+ nonRelativeExternalModuleResolutions.clear();
118893
118908
  }
118894
118909
  function cleanupLibResolutionWatching(newProgram) {
118895
118910
  resolvedLibraries.forEach((resolution, libFileName) => {
@@ -118907,7 +118922,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118907
118922
  function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
118908
118923
  filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
118909
118924
  allModuleAndTypeResolutionsAreInvalidated = false;
118910
- watchFailedLookupLocationOfNonRelativeModuleResolutions();
118925
+ nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
118926
+ nonRelativeExternalModuleResolutions.clear();
118911
118927
  if (newProgram !== oldProgram) {
118912
118928
  cleanupLibResolutionWatching(newProgram);
118913
118929
  newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
@@ -119188,7 +119204,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119188
119204
  if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
119189
119205
  watchFailedLookupLocationOfResolution(resolution);
119190
119206
  } else {
119191
- nonRelativeExternalModuleResolutions.add(resolution);
119207
+ nonRelativeExternalModuleResolutions.add(name, resolution);
119192
119208
  }
119193
119209
  const resolved = getResolutionWithResolvedFileName(resolution);
119194
119210
  if (resolved && resolved.resolvedFileName) {
@@ -119318,9 +119334,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119318
119334
  paths.add(affectingLocation);
119319
119335
  }
119320
119336
  }
119321
- function watchFailedLookupLocationOfNonRelativeModuleResolutions() {
119322
- nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfResolution);
119323
- nonRelativeExternalModuleResolutions.clear();
119337
+ function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
119338
+ const program = resolutionHost.getCurrentProgram();
119339
+ if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
119340
+ resolutions.forEach(watchFailedLookupLocationOfResolution);
119341
+ } else {
119342
+ resolutions.forEach((resolution) => watchAffectingLocationsOfResolution(
119343
+ resolution,
119344
+ /*addToResolutionsWithOnlyAffectingLocations*/
119345
+ true
119346
+ ));
119347
+ }
119324
119348
  }
119325
119349
  function setDirectoryWatcher(dir, dirPath, nonRecursive) {
119326
119350
  const dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);