typescript 4.9.0-dev.20221021 → 4.9.0-dev.20221022

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/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.9";
72
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221021");
72
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221022");
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -1606,8 +1606,8 @@ var ts;
1606
1606
  return compareValues(a === null || a === void 0 ? void 0 : a.start, b === null || b === void 0 ? void 0 : b.start) || compareValues(a === null || a === void 0 ? void 0 : a.length, b === null || b === void 0 ? void 0 : b.length);
1607
1607
  }
1608
1608
  ts.compareTextSpans = compareTextSpans;
1609
- function min(a, b, compare) {
1610
- return compare(a, b) === -1 ? a : b;
1609
+ function min(items, compare) {
1610
+ return reduceLeft(items, function (x, y) { return compare(x, y) === -1 ? x : y; });
1611
1611
  }
1612
1612
  ts.min = min;
1613
1613
  function compareStringsCaseInsensitive(a, b) {
@@ -61666,11 +61666,16 @@ var ts;
61666
61666
  var immediateContainer = ts.getSuperContainer(node, true);
61667
61667
  var container = immediateContainer;
61668
61668
  var needToCaptureLexicalThis = false;
61669
+ var inAsyncFunction = false;
61669
61670
  if (!isCallExpression) {
61670
61671
  while (container && container.kind === 216) {
61672
+ if (ts.hasSyntacticModifier(container, 512))
61673
+ inAsyncFunction = true;
61671
61674
  container = ts.getSuperContainer(container, true);
61672
61675
  needToCaptureLexicalThis = languageVersion < 2;
61673
61676
  }
61677
+ if (container && ts.hasSyntacticModifier(container, 512))
61678
+ inAsyncFunction = true;
61674
61679
  }
61675
61680
  var canUseSuperExpression = isLegalUsageOfSuperExpression(container);
61676
61681
  var nodeCheckFlag = 0;
@@ -61709,7 +61714,7 @@ var ts;
61709
61714
  nodeCheckFlag = 256;
61710
61715
  }
61711
61716
  getNodeLinks(node).flags |= nodeCheckFlag;
61712
- if (container.kind === 171 && ts.hasSyntacticModifier(container, 512)) {
61717
+ if (container.kind === 171 && inAsyncFunction) {
61713
61718
  if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
61714
61719
  getNodeLinks(container).flags |= 4096;
61715
61720
  }
@@ -69718,7 +69723,7 @@ var ts;
69718
69723
  if (isReferenceToType(type, getGlobalPromiseType(false))) {
69719
69724
  return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
69720
69725
  }
69721
- if (allTypesAssignableToKind(type, 131068 | 131072)) {
69726
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 | 131072)) {
69722
69727
  return undefined;
69723
69728
  }
69724
69729
  var thenFunction = getTypeOfPropertyOfType(type, "then");
@@ -69774,7 +69779,7 @@ var ts;
69774
69779
  return awaitedType || errorType;
69775
69780
  }
69776
69781
  function isThenableType(type) {
69777
- if (allTypesAssignableToKind(type, 131068 | 131072)) {
69782
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 | 131072)) {
69778
69783
  return false;
69779
69784
  }
69780
69785
  var thenFunction = getTypeOfPropertyOfType(type, "then");
@@ -82530,8 +82535,11 @@ var ts;
82530
82535
  }
82531
82536
  return ts.visitEachChild(node, visitor, context);
82532
82537
  case 174:
82538
+ return doWithContext(1 | 2, visitGetAccessorDeclaration, node);
82533
82539
  case 175:
82540
+ return doWithContext(1 | 2, visitSetAccessorDeclaration, node);
82534
82541
  case 173:
82542
+ return doWithContext(1 | 2, visitConstructorDeclaration, node);
82535
82543
  case 260:
82536
82544
  case 228:
82537
82545
  return doWithContext(1 | 2, visitDefault, node);
@@ -82622,10 +82630,19 @@ var ts;
82622
82630
  }
82623
82631
  return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node);
82624
82632
  }
82633
+ function visitConstructorDeclaration(node) {
82634
+ return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
82635
+ }
82625
82636
  function visitMethodDeclaration(node) {
82626
82637
  return factory.updateMethodDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.asteriskToken, node.name, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2
82627
82638
  ? transformAsyncFunctionBody(node)
82628
- : ts.visitFunctionBody(node.body, visitor, context));
82639
+ : transformMethodBody(node));
82640
+ }
82641
+ function visitGetAccessorDeclaration(node) {
82642
+ return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), undefined, transformMethodBody(node));
82643
+ }
82644
+ function visitSetAccessorDeclaration(node) {
82645
+ return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
82629
82646
  }
82630
82647
  function visitFunctionDeclaration(node) {
82631
82648
  return factory.updateFunctionDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2
@@ -82709,6 +82726,39 @@ var ts;
82709
82726
  }
82710
82727
  return false;
82711
82728
  }
82729
+ function transformMethodBody(node) {
82730
+ ts.Debug.assertIsDefined(node.body);
82731
+ var savedCapturedSuperProperties = capturedSuperProperties;
82732
+ var savedHasSuperElementAccess = hasSuperElementAccess;
82733
+ capturedSuperProperties = new ts.Set();
82734
+ hasSuperElementAccess = false;
82735
+ var updated = ts.visitFunctionBody(node.body, visitor, context);
82736
+ var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration);
82737
+ var emitSuperHelpers = languageVersion >= 2 &&
82738
+ resolver.getNodeCheckFlags(node) & (4096 | 2048) &&
82739
+ (ts.getFunctionFlags(originalMethod) & 3) !== 3;
82740
+ if (emitSuperHelpers) {
82741
+ enableSubstitutionForAsyncMethodsWithSuper();
82742
+ if (capturedSuperProperties.size) {
82743
+ var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
82744
+ substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true;
82745
+ var statements = updated.statements.slice();
82746
+ ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]);
82747
+ updated = factory.updateBlock(updated, statements);
82748
+ }
82749
+ if (hasSuperElementAccess) {
82750
+ if (resolver.getNodeCheckFlags(node) & 4096) {
82751
+ ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper);
82752
+ }
82753
+ else if (resolver.getNodeCheckFlags(node) & 2048) {
82754
+ ts.addEmitHelper(updated, ts.asyncSuperHelper);
82755
+ }
82756
+ }
82757
+ }
82758
+ capturedSuperProperties = savedCapturedSuperProperties;
82759
+ hasSuperElementAccess = savedHasSuperElementAccess;
82760
+ return updated;
82761
+ }
82712
82762
  function transformAsyncFunctionBody(node) {
82713
82763
  resumeLexicalEnvironment();
82714
82764
  var original = ts.getOriginalNode(node, ts.isFunctionLike);
@@ -102719,7 +102769,7 @@ var ts;
102719
102769
  var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47;
102720
102770
  if (isNonDirectorySeparatorRoot &&
102721
102771
  dirPath.search(/[a-zA-Z]:/) !== 0 &&
102722
- pathPartForUserCheck.search(/[a-zA-z]\$\//) === 0) {
102772
+ pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) {
102723
102773
  nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1);
102724
102774
  if (nextDirectorySeparator === -1) {
102725
102775
  return false;
@@ -103996,15 +104046,21 @@ var ts;
103996
104046
  return undefined;
103997
104047
  }
103998
104048
  function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
103999
- var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
104000
- if (normalizedTargetPath === undefined) {
104049
+ var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
104050
+ if (normalizedTargetPaths === undefined) {
104051
+ return undefined;
104052
+ }
104053
+ var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
104054
+ var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) {
104055
+ return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); });
104056
+ });
104057
+ var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators);
104058
+ if (!shortest) {
104001
104059
  return undefined;
104002
104060
  }
104003
- var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
104004
- var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
104005
104061
  return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
104006
- ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
104007
- : ts.removeFileExtension(relativePath);
104062
+ ? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions)
104063
+ : ts.removeFileExtension(shortest);
104008
104064
  }
104009
104065
  function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
104010
104066
  var path = _a.path, isRedirect = _a.isRedirect;
@@ -104124,8 +104180,8 @@ var ts;
104124
104180
  }
104125
104181
  }
104126
104182
  }
104127
- function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
104128
- return ts.firstDefined(rootDirs, function (rootDir) {
104183
+ function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
104184
+ return ts.mapDefined(rootDirs, function (rootDir) {
104129
104185
  var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
104130
104186
  return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
104131
104187
  });
package/lib/tsserver.js CHANGED
@@ -109,7 +109,7 @@ var ts;
109
109
  // The following is baselined as a literal template type without intervention
110
110
  /** The version of the TypeScript compiler release */
111
111
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
112
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221021");
112
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221022");
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -1901,8 +1901,8 @@ var ts;
1901
1901
  return compareValues(a === null || a === void 0 ? void 0 : a.start, b === null || b === void 0 ? void 0 : b.start) || compareValues(a === null || a === void 0 ? void 0 : a.length, b === null || b === void 0 ? void 0 : b.length);
1902
1902
  }
1903
1903
  ts.compareTextSpans = compareTextSpans;
1904
- function min(a, b, compare) {
1905
- return compare(a, b) === -1 /* Comparison.LessThan */ ? a : b;
1904
+ function min(items, compare) {
1905
+ return reduceLeft(items, function (x, y) { return compare(x, y) === -1 /* Comparison.LessThan */ ? x : y; });
1906
1906
  }
1907
1907
  ts.min = min;
1908
1908
  /**
@@ -5119,8 +5119,8 @@ var ts;
5119
5119
  NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance";
5120
5120
  NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic";
5121
5121
  NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked";
5122
- NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuper"] = 2048] = "AsyncMethodWithSuper";
5123
- NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuperBinding"] = 4096] = "AsyncMethodWithSuperBinding";
5122
+ NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAccessInAsync"] = 2048] = "MethodWithSuperPropertyAccessInAsync";
5123
+ NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAssignmentInAsync"] = 4096] = "MethodWithSuperPropertyAssignmentInAsync";
5124
5124
  NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments";
5125
5125
  NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed";
5126
5126
  NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass";
@@ -73685,12 +73685,17 @@ var ts;
73685
73685
  var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true);
73686
73686
  var container = immediateContainer;
73687
73687
  var needToCaptureLexicalThis = false;
73688
+ var inAsyncFunction = false;
73688
73689
  // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting
73689
73690
  if (!isCallExpression) {
73690
73691
  while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) {
73692
+ if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */))
73693
+ inAsyncFunction = true;
73691
73694
  container = ts.getSuperContainer(container, /*stopOnFunctions*/ true);
73692
73695
  needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */;
73693
73696
  }
73697
+ if (container && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */))
73698
+ inAsyncFunction = true;
73694
73699
  }
73695
73700
  var canUseSuperExpression = isLegalUsageOfSuperExpression(container);
73696
73701
  var nodeCheckFlag = 0;
@@ -73796,12 +73801,12 @@ var ts;
73796
73801
  // as a call expression cannot be used as the target of a destructuring assignment while a property access can.
73797
73802
  //
73798
73803
  // For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations.
73799
- if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) {
73804
+ if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && inAsyncFunction) {
73800
73805
  if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
73801
- getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */;
73806
+ getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */;
73802
73807
  }
73803
73808
  else {
73804
- getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.AsyncMethodWithSuper */;
73809
+ getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */;
73805
73810
  }
73806
73811
  }
73807
73812
  if (needToCaptureLexicalThis) {
@@ -82957,7 +82962,7 @@ var ts;
82957
82962
  return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
82958
82963
  }
82959
82964
  // primitives with a `{ then() }` won't be unwrapped/adopted.
82960
- if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
82965
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
82961
82966
  return undefined;
82962
82967
  }
82963
82968
  var thenFunction = getTypeOfPropertyOfType(type, "then"); // TODO: GH#18217
@@ -83024,7 +83029,7 @@ var ts;
83024
83029
  * Determines whether a type is an object with a callable `then` member.
83025
83030
  */
83026
83031
  function isThenableType(type) {
83027
- if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
83032
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
83028
83033
  // primitive types cannot be considered "thenable" since they are not objects.
83029
83034
  return false;
83030
83035
  }
@@ -98523,8 +98528,11 @@ var ts;
98523
98528
  }
98524
98529
  return ts.visitEachChild(node, visitor, context);
98525
98530
  case 174 /* SyntaxKind.GetAccessor */:
98531
+ return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitGetAccessorDeclaration, node);
98526
98532
  case 175 /* SyntaxKind.SetAccessor */:
98533
+ return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitSetAccessorDeclaration, node);
98527
98534
  case 173 /* SyntaxKind.Constructor */:
98535
+ return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitConstructorDeclaration, node);
98528
98536
  case 260 /* SyntaxKind.ClassDeclaration */:
98529
98537
  case 228 /* SyntaxKind.ClassExpression */:
98530
98538
  return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node);
@@ -98625,6 +98633,9 @@ var ts;
98625
98633
  return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(
98626
98634
  /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node);
98627
98635
  }
98636
+ function visitConstructorDeclaration(node) {
98637
+ return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
98638
+ }
98628
98639
  /**
98629
98640
  * Visits a MethodDeclaration node.
98630
98641
  *
@@ -98639,7 +98650,14 @@ var ts;
98639
98650
  /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
98640
98651
  /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* FunctionFlags.Async */
98641
98652
  ? transformAsyncFunctionBody(node)
98642
- : ts.visitFunctionBody(node.body, visitor, context));
98653
+ : transformMethodBody(node));
98654
+ }
98655
+ function visitGetAccessorDeclaration(node) {
98656
+ return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context),
98657
+ /*type*/ undefined, transformMethodBody(node));
98658
+ }
98659
+ function visitSetAccessorDeclaration(node) {
98660
+ return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
98643
98661
  }
98644
98662
  /**
98645
98663
  * Visits a FunctionDeclaration node.
@@ -98753,6 +98771,42 @@ var ts;
98753
98771
  }
98754
98772
  return false;
98755
98773
  }
98774
+ function transformMethodBody(node) {
98775
+ ts.Debug.assertIsDefined(node.body);
98776
+ var savedCapturedSuperProperties = capturedSuperProperties;
98777
+ var savedHasSuperElementAccess = hasSuperElementAccess;
98778
+ capturedSuperProperties = new ts.Set();
98779
+ hasSuperElementAccess = false;
98780
+ var updated = ts.visitFunctionBody(node.body, visitor, context);
98781
+ // Minor optimization, emit `_super` helper to capture `super` access in an arrow.
98782
+ // This step isn't needed if we eventually transform this to ES5.
98783
+ var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration);
98784
+ var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ &&
98785
+ resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) &&
98786
+ (ts.getFunctionFlags(originalMethod) & 3 /* FunctionFlags.AsyncGenerator */) !== 3 /* FunctionFlags.AsyncGenerator */;
98787
+ if (emitSuperHelpers) {
98788
+ enableSubstitutionForAsyncMethodsWithSuper();
98789
+ if (capturedSuperProperties.size) {
98790
+ var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
98791
+ substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true;
98792
+ var statements = updated.statements.slice();
98793
+ ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]);
98794
+ updated = factory.updateBlock(updated, statements);
98795
+ }
98796
+ if (hasSuperElementAccess) {
98797
+ // Emit helpers for super element access expressions (`super[x]`).
98798
+ if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
98799
+ ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper);
98800
+ }
98801
+ else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
98802
+ ts.addEmitHelper(updated, ts.asyncSuperHelper);
98803
+ }
98804
+ }
98805
+ }
98806
+ capturedSuperProperties = savedCapturedSuperProperties;
98807
+ hasSuperElementAccess = savedHasSuperElementAccess;
98808
+ return updated;
98809
+ }
98756
98810
  function transformAsyncFunctionBody(node) {
98757
98811
  resumeLexicalEnvironment();
98758
98812
  var original = ts.getOriginalNode(node, ts.isFunctionLike);
@@ -98785,7 +98839,7 @@ var ts;
98785
98839
  ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
98786
98840
  // Minor optimization, emit `_super` helper to capture `super` access in an arrow.
98787
98841
  // This step isn't needed if we eventually transform this to ES5.
98788
- var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */);
98842
+ var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */);
98789
98843
  if (emitSuperHelpers) {
98790
98844
  enableSubstitutionForAsyncMethodsWithSuper();
98791
98845
  if (capturedSuperProperties.size) {
@@ -98798,10 +98852,10 @@ var ts;
98798
98852
  ts.setTextRange(block, node.body);
98799
98853
  if (emitSuperHelpers && hasSuperElementAccess) {
98800
98854
  // Emit helpers for super element access expressions (`super[x]`).
98801
- if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) {
98855
+ if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
98802
98856
  ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
98803
98857
  }
98804
- else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) {
98858
+ else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
98805
98859
  ts.addEmitHelper(block, ts.asyncSuperHelper);
98806
98860
  }
98807
98861
  }
@@ -98873,7 +98927,7 @@ var ts;
98873
98927
  // If we need to support substitutions for `super` in an async method,
98874
98928
  // we should track it here.
98875
98929
  if (enabledSubstitutions & 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) {
98876
- var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */);
98930
+ var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */);
98877
98931
  if (superContainerFlags !== enclosingSuperContainerFlags) {
98878
98932
  var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
98879
98933
  enclosingSuperContainerFlags = superContainerFlags;
@@ -98950,7 +99004,7 @@ var ts;
98950
99004
  || kind === 175 /* SyntaxKind.SetAccessor */;
98951
99005
  }
98952
99006
  function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
98953
- if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) {
99007
+ if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
98954
99008
  return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createUniqueName("_superIndex", 16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */),
98955
99009
  /*typeArguments*/ undefined, [argumentExpression]), "value"), location);
98956
99010
  }
@@ -98965,7 +99019,7 @@ var ts;
98965
99019
  function createSuperAccessVariableStatement(factory, resolver, node, names) {
98966
99020
  // Create a variable declaration with a getter/setter (if binding) definition for each name:
98967
99021
  // const _super = Object.create(null, { x: { get: () => super.x, set: (v) => super.x = v }, ... });
98968
- var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) !== 0;
99022
+ var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) !== 0;
98969
99023
  var accessors = [];
98970
99024
  names.forEach(function (_, key) {
98971
99025
  var name = ts.unescapeLeadingUnderscores(key);
@@ -99673,7 +99727,7 @@ var ts;
99673
99727
  /*type*/ undefined, factory.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !!(hierarchyFacts & 1 /* HierarchyFacts.HasLexicalThis */)));
99674
99728
  // Minor optimization, emit `_super` helper to capture `super` access in an arrow.
99675
99729
  // This step isn't needed if we eventually transform this to ES5.
99676
- var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */);
99730
+ var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */);
99677
99731
  if (emitSuperHelpers) {
99678
99732
  enableSubstitutionForAsyncMethodsWithSuper();
99679
99733
  var variableStatement = ts.createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
@@ -99684,10 +99738,10 @@ var ts;
99684
99738
  ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
99685
99739
  var block = factory.updateBlock(node.body, statements);
99686
99740
  if (emitSuperHelpers && hasSuperElementAccess) {
99687
- if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) {
99741
+ if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
99688
99742
  ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
99689
99743
  }
99690
- else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) {
99744
+ else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
99691
99745
  ts.addEmitHelper(block, ts.asyncSuperHelper);
99692
99746
  }
99693
99747
  }
@@ -99816,7 +99870,7 @@ var ts;
99816
99870
  // If we need to support substitutions for `super` in an async method,
99817
99871
  // we should track it here.
99818
99872
  if (enabledSubstitutions & 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) {
99819
- var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */);
99873
+ var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */);
99820
99874
  if (superContainerFlags !== enclosingSuperContainerFlags) {
99821
99875
  var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
99822
99876
  enclosingSuperContainerFlags = superContainerFlags;
@@ -99893,7 +99947,7 @@ var ts;
99893
99947
  || kind === 175 /* SyntaxKind.SetAccessor */;
99894
99948
  }
99895
99949
  function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
99896
- if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) {
99950
+ if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
99897
99951
  return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("_superIndex"),
99898
99952
  /*typeArguments*/ undefined, [argumentExpression]), "value"), location);
99899
99953
  }
@@ -123919,7 +123973,7 @@ var ts;
123919
123973
  var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* CharacterCodes.slash */;
123920
123974
  if (isNonDirectorySeparatorRoot &&
123921
123975
  dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths
123922
- pathPartForUserCheck.search(/[a-zA-z]\$\//) === 0) { // Dos style nextPart
123976
+ pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { // Dos style nextPart
123923
123977
  nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1);
123924
123978
  if (nextDirectorySeparator === -1) {
123925
123979
  // ignore "//vda1cs4850/c$/folderAtRoot"
@@ -125425,15 +125479,21 @@ var ts;
125425
125479
  return undefined;
125426
125480
  }
125427
125481
  function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
125428
- var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
125429
- if (normalizedTargetPath === undefined) {
125482
+ var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
125483
+ if (normalizedTargetPaths === undefined) {
125484
+ return undefined;
125485
+ }
125486
+ var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
125487
+ var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) {
125488
+ return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); });
125489
+ });
125490
+ var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators);
125491
+ if (!shortest) {
125430
125492
  return undefined;
125431
125493
  }
125432
- var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
125433
- var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
125434
125494
  return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
125435
- ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
125436
- : ts.removeFileExtension(relativePath);
125495
+ ? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions)
125496
+ : ts.removeFileExtension(shortest);
125437
125497
  }
125438
125498
  function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
125439
125499
  var path = _a.path, isRedirect = _a.isRedirect;
@@ -125570,8 +125630,8 @@ var ts;
125570
125630
  }
125571
125631
  }
125572
125632
  }
125573
- function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
125574
- return ts.firstDefined(rootDirs, function (rootDir) {
125633
+ function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
125634
+ return ts.mapDefined(rootDirs, function (rootDir) {
125575
125635
  var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
125576
125636
  return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
125577
125637
  });
@@ -145661,7 +145721,7 @@ var ts;
145661
145721
  return bestMatch;
145662
145722
  }
145663
145723
  function betterMatch(a, b) {
145664
- return ts.min(a, b, compareMatches);
145724
+ return ts.min([a, b], compareMatches);
145665
145725
  }
145666
145726
  function compareMatches(a, b) {
145667
145727
  return a === undefined ? 1 /* Comparison.GreaterThan */ : b === undefined ? -1 /* Comparison.LessThan */