typescript 4.5.0-dev.20211023 → 4.5.0-dev.20211027

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.
package/lib/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-dev.20211023";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20211027";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -49408,21 +49408,28 @@ var ts;
49408
49408
  var namespaceName = getFullyQualifiedName(namespace);
49409
49409
  var declarationName = ts.declarationNameToString(right);
49410
49410
  var suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace);
49411
- var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
49412
- var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
49413
- var canSuggestTypeof = containingQualifiedName && !ts.isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName);
49414
49411
  if (suggestionForNonexistentModule) {
49415
49412
  error(right, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
49413
+ return undefined;
49416
49414
  }
49417
- else if (canSuggestTypeof) {
49415
+ var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
49416
+ var canSuggestTypeof = globalObjectType // <-- can't pull on types if global types aren't initialized yet
49417
+ && (meaning & 788968 /* Type */)
49418
+ && containingQualifiedName
49419
+ && !ts.isTypeOfExpression(containingQualifiedName.parent)
49420
+ && tryGetQualifiedNameAsValue(containingQualifiedName);
49421
+ if (canSuggestTypeof) {
49418
49422
  error(containingQualifiedName, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, ts.entityNameToString(containingQualifiedName));
49423
+ return undefined;
49419
49424
  }
49420
- else if (meaning & 1920 /* Namespace */ && exportedTypeSymbol && ts.isQualifiedName(name.parent)) {
49421
- error(name.parent.right, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), ts.unescapeLeadingUnderscores(name.parent.right.escapedText));
49422
- }
49423
- else {
49424
- error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
49425
+ if (meaning & 1920 /* Namespace */ && ts.isQualifiedName(name.parent)) {
49426
+ var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
49427
+ if (exportedTypeSymbol) {
49428
+ error(name.parent.right, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), ts.unescapeLeadingUnderscores(name.parent.right.escapedText));
49429
+ return undefined;
49430
+ }
49425
49431
  }
49432
+ error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
49426
49433
  }
49427
49434
  return undefined;
49428
49435
  }
@@ -59335,7 +59342,7 @@ var ts;
59335
59342
  var _loop_16 = function () {
59336
59343
  i--;
59337
59344
  var t = types[i];
59338
- if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeSubtypeOf(t, template); })) {
59345
+ if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
59339
59346
  ts.orderedRemoveItemAt(types, i);
59340
59347
  }
59341
59348
  };
@@ -63068,13 +63075,12 @@ var ts;
63068
63075
  traceUnionsOrIntersectionsTooLarge(source, target);
63069
63076
  var result = 0 /* False */;
63070
63077
  var saveErrorInfo = captureErrorCalculationState();
63071
- // Note that these checks are specifically ordered to produce correct results. In particular,
63072
- // we need to deconstruct unions before intersections (because unions are always at the top),
63073
- // and we need to handle "each" relations before "some" relations for the same kind of type.
63074
- if (source.flags & 3145728 /* UnionOrIntersection */ || target.flags & 3145728 /* UnionOrIntersection */) {
63075
- result = getConstituentCount(source) * getConstituentCount(target) >= 4 ?
63076
- recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */, recursionFlags) :
63077
- structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
63078
+ if ((source.flags & 1048576 /* Union */ || target.flags & 1048576 /* Union */) && getConstituentCount(source) * getConstituentCount(target) < 4) {
63079
+ // We skip caching when source or target is a union with no more than three constituents.
63080
+ result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
63081
+ }
63082
+ else if (source.flags & 3145728 /* UnionOrIntersection */ || target.flags & 3145728 /* UnionOrIntersection */) {
63083
+ result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */, recursionFlags);
63078
63084
  }
63079
63085
  if (!result && !(source.flags & 1048576 /* Union */) && (source.flags & (469499904 /* StructuredOrInstantiable */) || target.flags & 469499904 /* StructuredOrInstantiable */)) {
63080
63086
  if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags)) {
@@ -63531,19 +63537,19 @@ var ts;
63531
63537
  var maybeStart = maybeCount;
63532
63538
  maybeKeys[maybeCount] = id;
63533
63539
  maybeCount++;
63540
+ var saveExpandingFlags = expandingFlags;
63534
63541
  if (recursionFlags & 1 /* Source */) {
63535
63542
  sourceStack[sourceDepth] = source;
63536
63543
  sourceDepth++;
63544
+ if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
63545
+ expandingFlags |= 1 /* Source */;
63537
63546
  }
63538
63547
  if (recursionFlags & 2 /* Target */) {
63539
63548
  targetStack[targetDepth] = target;
63540
63549
  targetDepth++;
63550
+ if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
63551
+ expandingFlags |= 2 /* Target */;
63541
63552
  }
63542
- var saveExpandingFlags = expandingFlags;
63543
- if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
63544
- expandingFlags |= 1 /* Source */;
63545
- if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
63546
- expandingFlags |= 2 /* Target */;
63547
63553
  var originalHandler;
63548
63554
  var propagatingVarianceFlags = 0;
63549
63555
  if (outofbandVarianceMarkerHandler) {
@@ -63567,13 +63573,13 @@ var ts;
63567
63573
  if (outofbandVarianceMarkerHandler) {
63568
63574
  outofbandVarianceMarkerHandler = originalHandler;
63569
63575
  }
63570
- expandingFlags = saveExpandingFlags;
63571
63576
  if (recursionFlags & 1 /* Source */) {
63572
63577
  sourceDepth--;
63573
63578
  }
63574
63579
  if (recursionFlags & 2 /* Target */) {
63575
63580
  targetDepth--;
63576
63581
  }
63582
+ expandingFlags = saveExpandingFlags;
63577
63583
  if (result) {
63578
63584
  if (result === -1 /* True */ || (sourceDepth === 0 && targetDepth === 0)) {
63579
63585
  if (result === -1 /* True */ || result === 3 /* Maybe */) {
@@ -63911,8 +63917,7 @@ var ts;
63911
63917
  // For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
63912
63918
  instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
63913
63919
  }
63914
- var result_9 = inferTypesFromTemplateLiteralType(source, target);
63915
- if (result_9 && ts.every(result_9, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); })) {
63920
+ if (isTypeMatchedByTemplateLiteralType(source, target)) {
63916
63921
  return -1 /* True */;
63917
63922
  }
63918
63923
  }
@@ -64107,9 +64112,9 @@ var ts;
64107
64112
  if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 1048576 /* Union */) {
64108
64113
  var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */ | 2097152 /* Intersection */ | 33554432 /* Substitution */);
64109
64114
  if (objectOnlyTarget.flags & 1048576 /* Union */) {
64110
- var result_10 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
64111
- if (result_10) {
64112
- return result_10;
64115
+ var result_9 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
64116
+ if (result_9) {
64117
+ return result_9;
64113
64118
  }
64114
64119
  }
64115
64120
  }
@@ -64181,13 +64186,13 @@ var ts;
64181
64186
  var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
64182
64187
  getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
64183
64188
  if (modifiersRelated) {
64184
- var result_11;
64189
+ var result_10;
64185
64190
  var targetConstraint = getConstraintTypeFromMappedType(target);
64186
64191
  var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), makeFunctionTypeMapper(getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers));
64187
- if (result_11 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
64192
+ if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
64188
64193
  var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
64189
64194
  if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
64190
- return result_11 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3 /* Both */, reportErrors);
64195
+ return result_10 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3 /* Both */, reportErrors);
64191
64196
  }
64192
64197
  }
64193
64198
  }
@@ -66270,6 +66275,10 @@ var ts;
66270
66275
  inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) :
66271
66276
  undefined;
66272
66277
  }
66278
+ function isTypeMatchedByTemplateLiteralType(source, target) {
66279
+ var inferences = inferTypesFromTemplateLiteralType(source, target);
66280
+ return !!inferences && ts.every(inferences, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); });
66281
+ }
66273
66282
  function getStringLikeTypeForType(type) {
66274
66283
  return type.flags & (1 /* Any */ | 402653316 /* StringLike */) ? type : getTemplateLiteralType(["", ""], [type]);
66275
66284
  }
@@ -67805,7 +67814,7 @@ var ts;
67805
67814
  mapType(type, mapper);
67806
67815
  }
67807
67816
  function getConstituentCount(type) {
67808
- return type.flags & 3145728 /* UnionOrIntersection */ ? type.types.length : 1;
67817
+ return type.flags & 1048576 /* Union */ ? type.types.length : 1;
67809
67818
  }
67810
67819
  function extractTypesOfKind(type, kind) {
67811
67820
  return filterType(type, function (t) { return (t.flags & kind) !== 0; });
@@ -69303,7 +69312,7 @@ var ts;
69303
69312
  return parent.kind === 205 /* PropertyAccessExpression */ ||
69304
69313
  parent.kind === 207 /* CallExpression */ && parent.expression === node ||
69305
69314
  parent.kind === 206 /* ElementAccessExpression */ && parent.expression === node &&
69306
- !(isGenericTypeWithoutNullableConstraint(type) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
69315
+ !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
69307
69316
  }
69308
69317
  function isGenericTypeWithUnionConstraint(type) {
69309
69318
  return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
@@ -78732,12 +78741,12 @@ var ts;
78732
78741
  case 264 /* ImportEqualsDeclaration */:
78733
78742
  case 267 /* NamespaceImport */:
78734
78743
  case 266 /* ImportClause */:
78735
- var result_12 = 0 /* None */;
78744
+ var result_11 = 0 /* None */;
78736
78745
  var target = resolveAlias(getSymbolOfNode(d));
78737
78746
  ts.forEach(target.declarations, function (d) {
78738
- result_12 |= getDeclarationSpaces(d);
78747
+ result_11 |= getDeclarationSpaces(d);
78739
78748
  });
78740
- return result_12;
78749
+ return result_11;
78741
78750
  case 253 /* VariableDeclaration */:
78742
78751
  case 202 /* BindingElement */:
78743
78752
  case 255 /* FunctionDeclaration */:
@@ -94910,8 +94919,8 @@ var ts;
94910
94919
  function convertJsxChildrenToChildrenPropAssignment(children) {
94911
94920
  var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
94912
94921
  if (ts.length(nonWhitespaceChildren) === 1) {
94913
- var result_13 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
94914
- return result_13 && factory.createPropertyAssignment("children", result_13);
94922
+ var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
94923
+ return result_12 && factory.createPropertyAssignment("children", result_12);
94915
94924
  }
94916
94925
  var result = ts.mapDefined(children, transformJsxChildToExpression);
94917
94926
  return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
@@ -113711,15 +113720,15 @@ var ts;
113711
113720
  // which per above occurred during the current program creation.
113712
113721
  // Since we assume the filesystem does not change during program creation,
113713
113722
  // it is safe to reuse resolutions from the earlier call.
113714
- var result_14 = [];
113723
+ var result_13 = [];
113715
113724
  var i = 0;
113716
113725
  for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
113717
113726
  var moduleName = moduleNames_1[_i];
113718
113727
  var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
113719
113728
  i++;
113720
- result_14.push(resolvedModule);
113729
+ result_13.push(resolvedModule);
113721
113730
  }
113722
- return result_14;
113731
+ return result_13;
113723
113732
  }
113724
113733
  // At this point, we know at least one of the following hold:
113725
113734
  // - file has local declarations for ambient modules
@@ -118781,9 +118790,9 @@ var ts;
118781
118790
  if (!preferSymlinks) {
118782
118791
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
118783
118792
  // so we only need to remove them from the realpath filenames.
118784
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
118785
- if (result_15)
118786
- return result_15;
118793
+ var result_14 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
118794
+ if (result_14)
118795
+ return result_14;
118787
118796
  }
118788
118797
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
118789
118798
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -118803,10 +118812,10 @@ var ts;
118803
118812
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
118804
118813
  var symlinkDirectory = symlinkDirectories_1[_i];
118805
118814
  var option = ts.resolvePath(symlinkDirectory, relative);
118806
- var result_16 = cb(option, target === referenceRedirect);
118815
+ var result_15 = cb(option, target === referenceRedirect);
118807
118816
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
118808
- if (result_16)
118809
- return result_16;
118817
+ if (result_15)
118818
+ return result_15;
118810
118819
  }
118811
118820
  });
118812
118821
  });
@@ -129611,6 +129620,8 @@ var ts;
129611
129620
  case 131 /* AsyncKeyword */:
129612
129621
  return containingNodeKind === 168 /* MethodDeclaration */ // const obj = { async c|()
129613
129622
  || containingNodeKind === 295 /* ShorthandPropertyAssignment */; // const obj = { async c|
129623
+ case 41 /* AsteriskToken */:
129624
+ return containingNodeKind === 168 /* MethodDeclaration */; // const obj = { * c|
129614
129625
  }
129615
129626
  if (isClassMemberCompletionKeyword(tokenKind)) {
129616
129627
  return true;
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20211023";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20211027";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -49602,21 +49602,28 @@ var ts;
49602
49602
  var namespaceName = getFullyQualifiedName(namespace);
49603
49603
  var declarationName = ts.declarationNameToString(right);
49604
49604
  var suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace);
49605
- var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
49606
- var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
49607
- var canSuggestTypeof = containingQualifiedName && !ts.isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName);
49608
49605
  if (suggestionForNonexistentModule) {
49609
49606
  error(right, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
49607
+ return undefined;
49610
49608
  }
49611
- else if (canSuggestTypeof) {
49609
+ var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
49610
+ var canSuggestTypeof = globalObjectType // <-- can't pull on types if global types aren't initialized yet
49611
+ && (meaning & 788968 /* Type */)
49612
+ && containingQualifiedName
49613
+ && !ts.isTypeOfExpression(containingQualifiedName.parent)
49614
+ && tryGetQualifiedNameAsValue(containingQualifiedName);
49615
+ if (canSuggestTypeof) {
49612
49616
  error(containingQualifiedName, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, ts.entityNameToString(containingQualifiedName));
49617
+ return undefined;
49613
49618
  }
49614
- else if (meaning & 1920 /* Namespace */ && exportedTypeSymbol && ts.isQualifiedName(name.parent)) {
49615
- error(name.parent.right, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), ts.unescapeLeadingUnderscores(name.parent.right.escapedText));
49616
- }
49617
- else {
49618
- error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
49619
+ if (meaning & 1920 /* Namespace */ && ts.isQualifiedName(name.parent)) {
49620
+ var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
49621
+ if (exportedTypeSymbol) {
49622
+ error(name.parent.right, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), ts.unescapeLeadingUnderscores(name.parent.right.escapedText));
49623
+ return undefined;
49624
+ }
49619
49625
  }
49626
+ error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
49620
49627
  }
49621
49628
  return undefined;
49622
49629
  }
@@ -59529,7 +59536,7 @@ var ts;
59529
59536
  var _loop_16 = function () {
59530
59537
  i--;
59531
59538
  var t = types[i];
59532
- if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeSubtypeOf(t, template); })) {
59539
+ if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
59533
59540
  ts.orderedRemoveItemAt(types, i);
59534
59541
  }
59535
59542
  };
@@ -63262,13 +63269,12 @@ var ts;
63262
63269
  traceUnionsOrIntersectionsTooLarge(source, target);
63263
63270
  var result = 0 /* False */;
63264
63271
  var saveErrorInfo = captureErrorCalculationState();
63265
- // Note that these checks are specifically ordered to produce correct results. In particular,
63266
- // we need to deconstruct unions before intersections (because unions are always at the top),
63267
- // and we need to handle "each" relations before "some" relations for the same kind of type.
63268
- if (source.flags & 3145728 /* UnionOrIntersection */ || target.flags & 3145728 /* UnionOrIntersection */) {
63269
- result = getConstituentCount(source) * getConstituentCount(target) >= 4 ?
63270
- recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */, recursionFlags) :
63271
- structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
63272
+ if ((source.flags & 1048576 /* Union */ || target.flags & 1048576 /* Union */) && getConstituentCount(source) * getConstituentCount(target) < 4) {
63273
+ // We skip caching when source or target is a union with no more than three constituents.
63274
+ result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
63275
+ }
63276
+ else if (source.flags & 3145728 /* UnionOrIntersection */ || target.flags & 3145728 /* UnionOrIntersection */) {
63277
+ result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */, recursionFlags);
63272
63278
  }
63273
63279
  if (!result && !(source.flags & 1048576 /* Union */) && (source.flags & (469499904 /* StructuredOrInstantiable */) || target.flags & 469499904 /* StructuredOrInstantiable */)) {
63274
63280
  if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags)) {
@@ -63725,19 +63731,19 @@ var ts;
63725
63731
  var maybeStart = maybeCount;
63726
63732
  maybeKeys[maybeCount] = id;
63727
63733
  maybeCount++;
63734
+ var saveExpandingFlags = expandingFlags;
63728
63735
  if (recursionFlags & 1 /* Source */) {
63729
63736
  sourceStack[sourceDepth] = source;
63730
63737
  sourceDepth++;
63738
+ if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
63739
+ expandingFlags |= 1 /* Source */;
63731
63740
  }
63732
63741
  if (recursionFlags & 2 /* Target */) {
63733
63742
  targetStack[targetDepth] = target;
63734
63743
  targetDepth++;
63744
+ if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
63745
+ expandingFlags |= 2 /* Target */;
63735
63746
  }
63736
- var saveExpandingFlags = expandingFlags;
63737
- if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
63738
- expandingFlags |= 1 /* Source */;
63739
- if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
63740
- expandingFlags |= 2 /* Target */;
63741
63747
  var originalHandler;
63742
63748
  var propagatingVarianceFlags = 0;
63743
63749
  if (outofbandVarianceMarkerHandler) {
@@ -63761,13 +63767,13 @@ var ts;
63761
63767
  if (outofbandVarianceMarkerHandler) {
63762
63768
  outofbandVarianceMarkerHandler = originalHandler;
63763
63769
  }
63764
- expandingFlags = saveExpandingFlags;
63765
63770
  if (recursionFlags & 1 /* Source */) {
63766
63771
  sourceDepth--;
63767
63772
  }
63768
63773
  if (recursionFlags & 2 /* Target */) {
63769
63774
  targetDepth--;
63770
63775
  }
63776
+ expandingFlags = saveExpandingFlags;
63771
63777
  if (result) {
63772
63778
  if (result === -1 /* True */ || (sourceDepth === 0 && targetDepth === 0)) {
63773
63779
  if (result === -1 /* True */ || result === 3 /* Maybe */) {
@@ -64105,8 +64111,7 @@ var ts;
64105
64111
  // For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
64106
64112
  instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
64107
64113
  }
64108
- var result_9 = inferTypesFromTemplateLiteralType(source, target);
64109
- if (result_9 && ts.every(result_9, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); })) {
64114
+ if (isTypeMatchedByTemplateLiteralType(source, target)) {
64110
64115
  return -1 /* True */;
64111
64116
  }
64112
64117
  }
@@ -64301,9 +64306,9 @@ var ts;
64301
64306
  if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 1048576 /* Union */) {
64302
64307
  var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */ | 2097152 /* Intersection */ | 33554432 /* Substitution */);
64303
64308
  if (objectOnlyTarget.flags & 1048576 /* Union */) {
64304
- var result_10 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
64305
- if (result_10) {
64306
- return result_10;
64309
+ var result_9 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
64310
+ if (result_9) {
64311
+ return result_9;
64307
64312
  }
64308
64313
  }
64309
64314
  }
@@ -64375,13 +64380,13 @@ var ts;
64375
64380
  var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
64376
64381
  getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
64377
64382
  if (modifiersRelated) {
64378
- var result_11;
64383
+ var result_10;
64379
64384
  var targetConstraint = getConstraintTypeFromMappedType(target);
64380
64385
  var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), makeFunctionTypeMapper(getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers));
64381
- if (result_11 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
64386
+ if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
64382
64387
  var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
64383
64388
  if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
64384
- return result_11 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3 /* Both */, reportErrors);
64389
+ return result_10 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3 /* Both */, reportErrors);
64385
64390
  }
64386
64391
  }
64387
64392
  }
@@ -66464,6 +66469,10 @@ var ts;
66464
66469
  inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) :
66465
66470
  undefined;
66466
66471
  }
66472
+ function isTypeMatchedByTemplateLiteralType(source, target) {
66473
+ var inferences = inferTypesFromTemplateLiteralType(source, target);
66474
+ return !!inferences && ts.every(inferences, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); });
66475
+ }
66467
66476
  function getStringLikeTypeForType(type) {
66468
66477
  return type.flags & (1 /* Any */ | 402653316 /* StringLike */) ? type : getTemplateLiteralType(["", ""], [type]);
66469
66478
  }
@@ -67999,7 +68008,7 @@ var ts;
67999
68008
  mapType(type, mapper);
68000
68009
  }
68001
68010
  function getConstituentCount(type) {
68002
- return type.flags & 3145728 /* UnionOrIntersection */ ? type.types.length : 1;
68011
+ return type.flags & 1048576 /* Union */ ? type.types.length : 1;
68003
68012
  }
68004
68013
  function extractTypesOfKind(type, kind) {
68005
68014
  return filterType(type, function (t) { return (t.flags & kind) !== 0; });
@@ -69497,7 +69506,7 @@ var ts;
69497
69506
  return parent.kind === 205 /* PropertyAccessExpression */ ||
69498
69507
  parent.kind === 207 /* CallExpression */ && parent.expression === node ||
69499
69508
  parent.kind === 206 /* ElementAccessExpression */ && parent.expression === node &&
69500
- !(isGenericTypeWithoutNullableConstraint(type) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
69509
+ !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
69501
69510
  }
69502
69511
  function isGenericTypeWithUnionConstraint(type) {
69503
69512
  return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
@@ -78926,12 +78935,12 @@ var ts;
78926
78935
  case 264 /* ImportEqualsDeclaration */:
78927
78936
  case 267 /* NamespaceImport */:
78928
78937
  case 266 /* ImportClause */:
78929
- var result_12 = 0 /* None */;
78938
+ var result_11 = 0 /* None */;
78930
78939
  var target = resolveAlias(getSymbolOfNode(d));
78931
78940
  ts.forEach(target.declarations, function (d) {
78932
- result_12 |= getDeclarationSpaces(d);
78941
+ result_11 |= getDeclarationSpaces(d);
78933
78942
  });
78934
- return result_12;
78943
+ return result_11;
78935
78944
  case 253 /* VariableDeclaration */:
78936
78945
  case 202 /* BindingElement */:
78937
78946
  case 255 /* FunctionDeclaration */:
@@ -95104,8 +95113,8 @@ var ts;
95104
95113
  function convertJsxChildrenToChildrenPropAssignment(children) {
95105
95114
  var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
95106
95115
  if (ts.length(nonWhitespaceChildren) === 1) {
95107
- var result_13 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
95108
- return result_13 && factory.createPropertyAssignment("children", result_13);
95116
+ var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
95117
+ return result_12 && factory.createPropertyAssignment("children", result_12);
95109
95118
  }
95110
95119
  var result = ts.mapDefined(children, transformJsxChildToExpression);
95111
95120
  return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
@@ -113905,15 +113914,15 @@ var ts;
113905
113914
  // which per above occurred during the current program creation.
113906
113915
  // Since we assume the filesystem does not change during program creation,
113907
113916
  // it is safe to reuse resolutions from the earlier call.
113908
- var result_14 = [];
113917
+ var result_13 = [];
113909
113918
  var i = 0;
113910
113919
  for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
113911
113920
  var moduleName = moduleNames_1[_i];
113912
113921
  var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
113913
113922
  i++;
113914
- result_14.push(resolvedModule);
113923
+ result_13.push(resolvedModule);
113915
113924
  }
113916
- return result_14;
113925
+ return result_13;
113917
113926
  }
113918
113927
  // At this point, we know at least one of the following hold:
113919
113928
  // - file has local declarations for ambient modules
@@ -118975,9 +118984,9 @@ var ts;
118975
118984
  if (!preferSymlinks) {
118976
118985
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
118977
118986
  // so we only need to remove them from the realpath filenames.
118978
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
118979
- if (result_15)
118980
- return result_15;
118987
+ var result_14 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
118988
+ if (result_14)
118989
+ return result_14;
118981
118990
  }
118982
118991
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
118983
118992
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -118997,10 +119006,10 @@ var ts;
118997
119006
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
118998
119007
  var symlinkDirectory = symlinkDirectories_1[_i];
118999
119008
  var option = ts.resolvePath(symlinkDirectory, relative);
119000
- var result_16 = cb(option, target === referenceRedirect);
119009
+ var result_15 = cb(option, target === referenceRedirect);
119001
119010
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
119002
- if (result_16)
119003
- return result_16;
119011
+ if (result_15)
119012
+ return result_15;
119004
119013
  }
119005
119014
  });
119006
119015
  });
@@ -130193,6 +130202,8 @@ var ts;
130193
130202
  case 131 /* AsyncKeyword */:
130194
130203
  return containingNodeKind === 168 /* MethodDeclaration */ // const obj = { async c|()
130195
130204
  || containingNodeKind === 295 /* ShorthandPropertyAssignment */; // const obj = { async c|
130205
+ case 41 /* AsteriskToken */:
130206
+ return containingNodeKind === 168 /* MethodDeclaration */; // const obj = { * c|
130196
130207
  }
130197
130208
  if (isClassMemberCompletionKeyword(tokenKind)) {
130198
130209
  return true;