@typescript-deploys/pr-build 4.5.0-pr-46429-36 → 4.5.0-pr-46464-7

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/lib.es5.d.ts CHANGED
@@ -216,13 +216,13 @@ interface ObjectConstructor {
216
216
 
217
217
  /**
218
218
  * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
219
- * @param o Object on which to lock the attributes.
219
+ * @param a Object on which to lock the attributes.
220
220
  */
221
221
  freeze<T>(a: T[]): readonly T[];
222
222
 
223
223
  /**
224
224
  * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
225
- * @param o Object on which to lock the attributes.
225
+ * @param f Object on which to lock the attributes.
226
226
  */
227
227
  freeze<T extends Function>(f: T): T;
228
228
 
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.5";
72
- ts.version = ts.versionMajorMinor + ".0-insiders.20211021";
72
+ ts.version = ts.versionMajorMinor + ".0-insiders.20211022";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  function tryGetNativeMap() {
@@ -15846,7 +15846,7 @@ var ts;
15846
15846
  includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"),
15847
15847
  includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"),
15848
15848
  excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"),
15849
- basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames)
15849
+ basePaths: getBasePaths(absolutePath, includes, useCaseSensitiveFileNames)
15850
15850
  };
15851
15851
  }
15852
15852
  ts.getFileMatcherPatterns = getFileMatcherPatterns;
@@ -15865,20 +15865,20 @@ var ts;
15865
15865
  var visited = new ts.Map();
15866
15866
  var toCanonical = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
15867
15867
  for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
15868
- var basePath = _a[_i];
15869
- if (directoryExists(basePath)) {
15870
- visitDirectory(basePath, ts.combinePaths(currentDirectory, basePath), depth);
15868
+ var absoluteBasePath = _a[_i];
15869
+ if (directoryExists(absoluteBasePath)) {
15870
+ visitDirectory(absoluteBasePath, depth);
15871
15871
  }
15872
15872
  }
15873
15873
  return ts.flatten(results);
15874
- function visitDirectory(path, absolutePath, depth) {
15874
+ function visitDirectory(absolutePath, depth) {
15875
15875
  var canonicalPath = toCanonical(realpath(absolutePath));
15876
15876
  if (visited.has(canonicalPath))
15877
15877
  return;
15878
15878
  visited.set(canonicalPath, true);
15879
- var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;
15879
+ var _a = getFileSystemEntries(absolutePath), files = _a.files, directories = _a.directories;
15880
15880
  var _loop_1 = function (current) {
15881
- var name = ts.combinePaths(path, current);
15881
+ var name = ts.combinePaths(absolutePath, current);
15882
15882
  var absoluteName = ts.combinePaths(absolutePath, current);
15883
15883
  if (extensions && !ts.fileExtensionIsOneOf(name, extensions))
15884
15884
  return "continue";
@@ -15906,28 +15906,27 @@ var ts;
15906
15906
  }
15907
15907
  for (var _c = 0, _d = ts.sort(directories, ts.compareStringsCaseSensitive); _c < _d.length; _c++) {
15908
15908
  var current = _d[_c];
15909
- var name = ts.combinePaths(path, current);
15910
15909
  var absoluteName = ts.combinePaths(absolutePath, current);
15911
15910
  if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
15912
15911
  (!excludeRegex || !excludeRegex.test(absoluteName))) {
15913
- visitDirectory(name, absoluteName, depth);
15912
+ visitDirectory(absoluteName, depth);
15914
15913
  }
15915
15914
  }
15916
15915
  }
15917
15916
  }
15918
15917
  ts.matchFiles = matchFiles;
15919
- function getBasePaths(path, includes, useCaseSensitiveFileNames) {
15920
- var basePaths = [path];
15918
+ function getBasePaths(absoluteTsconfigPath, includes, useCaseSensitiveFileNames) {
15919
+ var basePaths = [absoluteTsconfigPath];
15921
15920
  if (includes) {
15922
15921
  var includeBasePaths = [];
15923
15922
  for (var _i = 0, includes_1 = includes; _i < includes_1.length; _i++) {
15924
15923
  var include = includes_1[_i];
15925
- var absolute = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(path, include));
15926
- includeBasePaths.push(getIncludeBasePath(absolute));
15924
+ var absoluteIncludePath = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(absoluteTsconfigPath, include));
15925
+ includeBasePaths.push(getIncludeBasePath(absoluteIncludePath));
15927
15926
  }
15928
15927
  includeBasePaths.sort(ts.getStringComparer(!useCaseSensitiveFileNames));
15929
15928
  var _loop_2 = function (includeBasePath) {
15930
- if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) {
15929
+ if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, absoluteTsconfigPath, !useCaseSensitiveFileNames); })) {
15931
15930
  basePaths.push(includeBasePath);
15932
15931
  }
15933
15932
  };
@@ -50422,13 +50421,14 @@ var ts;
50422
50421
  }
50423
50422
  return result;
50424
50423
  }
50424
+ function isDistributionDependent(root) {
50425
+ return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
50426
+ isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
50427
+ }
50425
50428
  function getTypeFromConditionalTypeNode(node) {
50426
50429
  var links = getNodeLinks(node);
50427
50430
  if (!links.resolvedType) {
50428
50431
  var checkType = getTypeFromTypeNode(node.checkType);
50429
- var isDistributive = !!(checkType.flags & 262144);
50430
- var isDistributionDependent = isDistributive && (isTypeParameterPossiblyReferenced(checkType, node.trueType) ||
50431
- isTypeParameterPossiblyReferenced(checkType, node.falseType));
50432
50432
  var aliasSymbol = getAliasSymbolForTypeNode(node);
50433
50433
  var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
50434
50434
  var allOuterTypeParameters = getOuterTypeParameters(node, true);
@@ -50437,8 +50437,7 @@ var ts;
50437
50437
  node: node,
50438
50438
  checkType: checkType,
50439
50439
  extendsType: getTypeFromTypeNode(node.extendsType),
50440
- isDistributive: isDistributive,
50441
- isDistributionDependent: isDistributionDependent,
50440
+ isDistributive: !!(checkType.flags & 262144),
50442
50441
  inferTypeParameters: getInferTypeParameters(node),
50443
50442
  outerTypeParameters: outerTypeParameters,
50444
50443
  instantiations: undefined,
@@ -53195,7 +53194,7 @@ var ts;
53195
53194
  return 3;
53196
53195
  }
53197
53196
  var c = target;
53198
- if (!c.root.inferTypeParameters && !c.root.isDistributionDependent) {
53197
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
53199
53198
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
53200
53199
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
53201
53200
  if (result = skipTrue ? -1 : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2, false)) {
@@ -64651,6 +64650,7 @@ var ts;
64651
64650
  var parent = node.parent;
64652
64651
  return ts.isAssertionExpression(parent) && ts.isConstTypeReference(parent.type) ||
64653
64652
  ts.isJSDocTypeAssertion(parent) && ts.isConstTypeReference(ts.getJSDocTypeAssertionType(parent)) ||
64653
+ ts.isComputedPropertyName(parent) ||
64654
64654
  (ts.isParenthesizedExpression(parent) || ts.isArrayLiteralExpression(parent) || ts.isSpreadElement(parent)) && isConstContext(parent) ||
64655
64655
  (ts.isPropertyAssignment(parent) || ts.isShorthandPropertyAssignment(parent) || ts.isTemplateSpan(parent)) && isConstContext(parent.parent);
64656
64656
  }
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-insiders.20211021";
103
+ ts.version = ts.versionMajorMinor + ".0-insiders.20211022";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -19993,7 +19993,7 @@ var ts;
19993
19993
  includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"),
19994
19994
  includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"),
19995
19995
  excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"),
19996
- basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames)
19996
+ basePaths: getBasePaths(absolutePath, includes, useCaseSensitiveFileNames)
19997
19997
  };
19998
19998
  }
19999
19999
  ts.getFileMatcherPatterns = getFileMatcherPatterns;
@@ -20015,20 +20015,20 @@ var ts;
20015
20015
  var visited = new ts.Map();
20016
20016
  var toCanonical = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
20017
20017
  for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
20018
- var basePath = _a[_i];
20019
- if (directoryExists(basePath)) {
20020
- visitDirectory(basePath, ts.combinePaths(currentDirectory, basePath), depth);
20018
+ var absoluteBasePath = _a[_i];
20019
+ if (directoryExists(absoluteBasePath)) {
20020
+ visitDirectory(absoluteBasePath, depth);
20021
20021
  }
20022
20022
  }
20023
20023
  return ts.flatten(results);
20024
- function visitDirectory(path, absolutePath, depth) {
20024
+ function visitDirectory(absolutePath, depth) {
20025
20025
  var canonicalPath = toCanonical(realpath(absolutePath));
20026
20026
  if (visited.has(canonicalPath))
20027
20027
  return;
20028
20028
  visited.set(canonicalPath, true);
20029
- var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;
20029
+ var _a = getFileSystemEntries(absolutePath), files = _a.files, directories = _a.directories;
20030
20030
  var _loop_1 = function (current) {
20031
- var name = ts.combinePaths(path, current);
20031
+ var name = ts.combinePaths(absolutePath, current);
20032
20032
  var absoluteName = ts.combinePaths(absolutePath, current);
20033
20033
  if (extensions && !ts.fileExtensionIsOneOf(name, extensions))
20034
20034
  return "continue";
@@ -20056,11 +20056,10 @@ var ts;
20056
20056
  }
20057
20057
  for (var _c = 0, _d = ts.sort(directories, ts.compareStringsCaseSensitive); _c < _d.length; _c++) {
20058
20058
  var current = _d[_c];
20059
- var name = ts.combinePaths(path, current);
20060
20059
  var absoluteName = ts.combinePaths(absolutePath, current);
20061
20060
  if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
20062
20061
  (!excludeRegex || !excludeRegex.test(absoluteName))) {
20063
- visitDirectory(name, absoluteName, depth);
20062
+ visitDirectory(absoluteName, depth);
20064
20063
  }
20065
20064
  }
20066
20065
  }
@@ -20068,10 +20067,11 @@ var ts;
20068
20067
  ts.matchFiles = matchFiles;
20069
20068
  /**
20070
20069
  * Computes the unique non-wildcard base paths amongst the provided include patterns.
20070
+ * @returns Absolute directory paths
20071
20071
  */
20072
- function getBasePaths(path, includes, useCaseSensitiveFileNames) {
20072
+ function getBasePaths(absoluteTsconfigPath, includes, useCaseSensitiveFileNames) {
20073
20073
  // Storage for our results in the form of literal paths (e.g. the paths as written by the user).
20074
- var basePaths = [path];
20074
+ var basePaths = [absoluteTsconfigPath];
20075
20075
  if (includes) {
20076
20076
  // Storage for literal base paths amongst the include patterns.
20077
20077
  var includeBasePaths = [];
@@ -20079,14 +20079,14 @@ var ts;
20079
20079
  var include = includes_1[_i];
20080
20080
  // We also need to check the relative paths by converting them to absolute and normalizing
20081
20081
  // in case they escape the base path (e.g "..\somedirectory")
20082
- var absolute = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(path, include));
20082
+ var absoluteIncludePath = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(absoluteTsconfigPath, include));
20083
20083
  // Append the literal and canonical candidate base paths.
20084
- includeBasePaths.push(getIncludeBasePath(absolute));
20084
+ includeBasePaths.push(getIncludeBasePath(absoluteIncludePath));
20085
20085
  }
20086
20086
  // Sort the offsets array using either the literal or canonical path representations.
20087
20087
  includeBasePaths.sort(ts.getStringComparer(!useCaseSensitiveFileNames));
20088
20088
  var _loop_2 = function (includeBasePath) {
20089
- if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) {
20089
+ if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, absoluteTsconfigPath, !useCaseSensitiveFileNames); })) {
20090
20090
  basePaths.push(includeBasePath);
20091
20091
  }
20092
20092
  };
@@ -60707,13 +60707,14 @@ var ts;
60707
60707
  }
60708
60708
  return result;
60709
60709
  }
60710
+ function isDistributionDependent(root) {
60711
+ return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
60712
+ isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
60713
+ }
60710
60714
  function getTypeFromConditionalTypeNode(node) {
60711
60715
  var links = getNodeLinks(node);
60712
60716
  if (!links.resolvedType) {
60713
60717
  var checkType = getTypeFromTypeNode(node.checkType);
60714
- var isDistributive = !!(checkType.flags & 262144 /* TypeParameter */);
60715
- var isDistributionDependent = isDistributive && (isTypeParameterPossiblyReferenced(checkType, node.trueType) ||
60716
- isTypeParameterPossiblyReferenced(checkType, node.falseType));
60717
60718
  var aliasSymbol = getAliasSymbolForTypeNode(node);
60718
60719
  var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
60719
60720
  var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
@@ -60722,8 +60723,7 @@ var ts;
60722
60723
  node: node,
60723
60724
  checkType: checkType,
60724
60725
  extendsType: getTypeFromTypeNode(node.extendsType),
60725
- isDistributive: isDistributive,
60726
- isDistributionDependent: isDistributionDependent,
60726
+ isDistributive: !!(checkType.flags & 262144 /* TypeParameter */),
60727
60727
  inferTypeParameters: getInferTypeParameters(node),
60728
60728
  outerTypeParameters: outerTypeParameters,
60729
60729
  instantiations: undefined,
@@ -63870,7 +63870,7 @@ var ts;
63870
63870
  // We check for a relationship to a conditional type target only when the conditional type has no
63871
63871
  // 'infer' positions and is not distributive or is distributive but doesn't reference the check type
63872
63872
  // parameter in either of the result types.
63873
- if (!c.root.inferTypeParameters && !c.root.isDistributionDependent) {
63873
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
63874
63874
  // Check if the conditional is always true or always false but still deferred for distribution purposes.
63875
63875
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
63876
63876
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
@@ -77164,6 +77164,7 @@ var ts;
77164
77164
  var parent = node.parent;
77165
77165
  return ts.isAssertionExpression(parent) && ts.isConstTypeReference(parent.type) ||
77166
77166
  ts.isJSDocTypeAssertion(parent) && ts.isConstTypeReference(ts.getJSDocTypeAssertionType(parent)) ||
77167
+ ts.isComputedPropertyName(parent) ||
77167
77168
  (ts.isParenthesizedExpression(parent) || ts.isArrayLiteralExpression(parent) || ts.isSpreadElement(parent)) && isConstContext(parent) ||
77168
77169
  (ts.isPropertyAssignment(parent) || ts.isShorthandPropertyAssignment(parent) || ts.isTemplateSpan(parent)) && isConstContext(parent.parent);
77169
77170
  }
@@ -148204,12 +148205,14 @@ var ts;
148204
148205
  }
148205
148206
  var allowsImportingSpecifier = ts.createPackageJsonImportFilter(sourceFile, preferences, host).allowsImportingSpecifier;
148206
148207
  return fixes.reduce(function (best, fix) {
148208
+ // Takes true branch of conditional if `fix` is better than `best`
148207
148209
  return compareModuleSpecifiers(fix, best, sourceFile, program, allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
148208
148210
  });
148209
148211
  }
148212
+ /** @returns `Comparison.LessThan` if `a` is better than `b`. */
148210
148213
  function compareModuleSpecifiers(a, b, importingFile, program, allowsImportingSpecifier) {
148211
148214
  if (a.kind !== 0 /* UseNamespace */ && b.kind !== 0 /* UseNamespace */) {
148212
- return ts.compareBooleans(allowsImportingSpecifier(a.moduleSpecifier), allowsImportingSpecifier(b.moduleSpecifier))
148215
+ return ts.compareBooleans(allowsImportingSpecifier(b.moduleSpecifier), allowsImportingSpecifier(a.moduleSpecifier))
148213
148216
  || compareNodeCoreModuleSpecifiers(a.moduleSpecifier, b.moduleSpecifier, importingFile, program)
148214
148217
  || ts.compareNumberOfDirectorySeparators(a.moduleSpecifier, b.moduleSpecifier);
148215
148218
  }
@@ -150861,7 +150864,8 @@ var ts;
150861
150864
  insertBefore = ts.findChildOfKind(containingFunction, 98 /* FunctionKeyword */, sourceFile);
150862
150865
  break;
150863
150866
  case 213 /* ArrowFunction */:
150864
- insertBefore = ts.findChildOfKind(containingFunction, 20 /* OpenParenToken */, sourceFile) || ts.first(containingFunction.parameters);
150867
+ var kind = containingFunction.typeParameters ? 29 /* LessThanToken */ : 20 /* OpenParenToken */;
150868
+ insertBefore = ts.findChildOfKind(containingFunction, kind, sourceFile) || ts.first(containingFunction.parameters);
150865
150869
  break;
150866
150870
  default:
150867
150871
  return;
@@ -2747,7 +2747,6 @@ declare namespace ts {
2747
2747
  checkType: Type;
2748
2748
  extendsType: Type;
2749
2749
  isDistributive: boolean;
2750
- isDistributionDependent: boolean;
2751
2750
  inferTypeParameters?: TypeParameter[];
2752
2751
  outerTypeParameters?: TypeParameter[];
2753
2752
  instantiations?: Map<Type>;
@@ -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-insiders.20211021";
297
+ ts.version = ts.versionMajorMinor + ".0-insiders.20211022";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -20187,7 +20187,7 @@ var ts;
20187
20187
  includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"),
20188
20188
  includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"),
20189
20189
  excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"),
20190
- basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames)
20190
+ basePaths: getBasePaths(absolutePath, includes, useCaseSensitiveFileNames)
20191
20191
  };
20192
20192
  }
20193
20193
  ts.getFileMatcherPatterns = getFileMatcherPatterns;
@@ -20209,20 +20209,20 @@ var ts;
20209
20209
  var visited = new ts.Map();
20210
20210
  var toCanonical = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
20211
20211
  for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
20212
- var basePath = _a[_i];
20213
- if (directoryExists(basePath)) {
20214
- visitDirectory(basePath, ts.combinePaths(currentDirectory, basePath), depth);
20212
+ var absoluteBasePath = _a[_i];
20213
+ if (directoryExists(absoluteBasePath)) {
20214
+ visitDirectory(absoluteBasePath, depth);
20215
20215
  }
20216
20216
  }
20217
20217
  return ts.flatten(results);
20218
- function visitDirectory(path, absolutePath, depth) {
20218
+ function visitDirectory(absolutePath, depth) {
20219
20219
  var canonicalPath = toCanonical(realpath(absolutePath));
20220
20220
  if (visited.has(canonicalPath))
20221
20221
  return;
20222
20222
  visited.set(canonicalPath, true);
20223
- var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;
20223
+ var _a = getFileSystemEntries(absolutePath), files = _a.files, directories = _a.directories;
20224
20224
  var _loop_1 = function (current) {
20225
- var name = ts.combinePaths(path, current);
20225
+ var name = ts.combinePaths(absolutePath, current);
20226
20226
  var absoluteName = ts.combinePaths(absolutePath, current);
20227
20227
  if (extensions && !ts.fileExtensionIsOneOf(name, extensions))
20228
20228
  return "continue";
@@ -20250,11 +20250,10 @@ var ts;
20250
20250
  }
20251
20251
  for (var _c = 0, _d = ts.sort(directories, ts.compareStringsCaseSensitive); _c < _d.length; _c++) {
20252
20252
  var current = _d[_c];
20253
- var name = ts.combinePaths(path, current);
20254
20253
  var absoluteName = ts.combinePaths(absolutePath, current);
20255
20254
  if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
20256
20255
  (!excludeRegex || !excludeRegex.test(absoluteName))) {
20257
- visitDirectory(name, absoluteName, depth);
20256
+ visitDirectory(absoluteName, depth);
20258
20257
  }
20259
20258
  }
20260
20259
  }
@@ -20262,10 +20261,11 @@ var ts;
20262
20261
  ts.matchFiles = matchFiles;
20263
20262
  /**
20264
20263
  * Computes the unique non-wildcard base paths amongst the provided include patterns.
20264
+ * @returns Absolute directory paths
20265
20265
  */
20266
- function getBasePaths(path, includes, useCaseSensitiveFileNames) {
20266
+ function getBasePaths(absoluteTsconfigPath, includes, useCaseSensitiveFileNames) {
20267
20267
  // Storage for our results in the form of literal paths (e.g. the paths as written by the user).
20268
- var basePaths = [path];
20268
+ var basePaths = [absoluteTsconfigPath];
20269
20269
  if (includes) {
20270
20270
  // Storage for literal base paths amongst the include patterns.
20271
20271
  var includeBasePaths = [];
@@ -20273,14 +20273,14 @@ var ts;
20273
20273
  var include = includes_1[_i];
20274
20274
  // We also need to check the relative paths by converting them to absolute and normalizing
20275
20275
  // in case they escape the base path (e.g "..\somedirectory")
20276
- var absolute = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(path, include));
20276
+ var absoluteIncludePath = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(absoluteTsconfigPath, include));
20277
20277
  // Append the literal and canonical candidate base paths.
20278
- includeBasePaths.push(getIncludeBasePath(absolute));
20278
+ includeBasePaths.push(getIncludeBasePath(absoluteIncludePath));
20279
20279
  }
20280
20280
  // Sort the offsets array using either the literal or canonical path representations.
20281
20281
  includeBasePaths.sort(ts.getStringComparer(!useCaseSensitiveFileNames));
20282
20282
  var _loop_2 = function (includeBasePath) {
20283
- if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) {
20283
+ if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, absoluteTsconfigPath, !useCaseSensitiveFileNames); })) {
20284
20284
  basePaths.push(includeBasePath);
20285
20285
  }
20286
20286
  };
@@ -60901,13 +60901,14 @@ var ts;
60901
60901
  }
60902
60902
  return result;
60903
60903
  }
60904
+ function isDistributionDependent(root) {
60905
+ return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
60906
+ isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
60907
+ }
60904
60908
  function getTypeFromConditionalTypeNode(node) {
60905
60909
  var links = getNodeLinks(node);
60906
60910
  if (!links.resolvedType) {
60907
60911
  var checkType = getTypeFromTypeNode(node.checkType);
60908
- var isDistributive = !!(checkType.flags & 262144 /* TypeParameter */);
60909
- var isDistributionDependent = isDistributive && (isTypeParameterPossiblyReferenced(checkType, node.trueType) ||
60910
- isTypeParameterPossiblyReferenced(checkType, node.falseType));
60911
60912
  var aliasSymbol = getAliasSymbolForTypeNode(node);
60912
60913
  var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
60913
60914
  var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
@@ -60916,8 +60917,7 @@ var ts;
60916
60917
  node: node,
60917
60918
  checkType: checkType,
60918
60919
  extendsType: getTypeFromTypeNode(node.extendsType),
60919
- isDistributive: isDistributive,
60920
- isDistributionDependent: isDistributionDependent,
60920
+ isDistributive: !!(checkType.flags & 262144 /* TypeParameter */),
60921
60921
  inferTypeParameters: getInferTypeParameters(node),
60922
60922
  outerTypeParameters: outerTypeParameters,
60923
60923
  instantiations: undefined,
@@ -64064,7 +64064,7 @@ var ts;
64064
64064
  // We check for a relationship to a conditional type target only when the conditional type has no
64065
64065
  // 'infer' positions and is not distributive or is distributive but doesn't reference the check type
64066
64066
  // parameter in either of the result types.
64067
- if (!c.root.inferTypeParameters && !c.root.isDistributionDependent) {
64067
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
64068
64068
  // Check if the conditional is always true or always false but still deferred for distribution purposes.
64069
64069
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
64070
64070
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
@@ -77358,6 +77358,7 @@ var ts;
77358
77358
  var parent = node.parent;
77359
77359
  return ts.isAssertionExpression(parent) && ts.isConstTypeReference(parent.type) ||
77360
77360
  ts.isJSDocTypeAssertion(parent) && ts.isConstTypeReference(ts.getJSDocTypeAssertionType(parent)) ||
77361
+ ts.isComputedPropertyName(parent) ||
77361
77362
  (ts.isParenthesizedExpression(parent) || ts.isArrayLiteralExpression(parent) || ts.isSpreadElement(parent)) && isConstContext(parent) ||
77362
77363
  (ts.isPropertyAssignment(parent) || ts.isShorthandPropertyAssignment(parent) || ts.isTemplateSpan(parent)) && isConstContext(parent.parent);
77363
77364
  }
@@ -148786,12 +148787,14 @@ var ts;
148786
148787
  }
148787
148788
  var allowsImportingSpecifier = ts.createPackageJsonImportFilter(sourceFile, preferences, host).allowsImportingSpecifier;
148788
148789
  return fixes.reduce(function (best, fix) {
148790
+ // Takes true branch of conditional if `fix` is better than `best`
148789
148791
  return compareModuleSpecifiers(fix, best, sourceFile, program, allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
148790
148792
  });
148791
148793
  }
148794
+ /** @returns `Comparison.LessThan` if `a` is better than `b`. */
148792
148795
  function compareModuleSpecifiers(a, b, importingFile, program, allowsImportingSpecifier) {
148793
148796
  if (a.kind !== 0 /* UseNamespace */ && b.kind !== 0 /* UseNamespace */) {
148794
- return ts.compareBooleans(allowsImportingSpecifier(a.moduleSpecifier), allowsImportingSpecifier(b.moduleSpecifier))
148797
+ return ts.compareBooleans(allowsImportingSpecifier(b.moduleSpecifier), allowsImportingSpecifier(a.moduleSpecifier))
148795
148798
  || compareNodeCoreModuleSpecifiers(a.moduleSpecifier, b.moduleSpecifier, importingFile, program)
148796
148799
  || ts.compareNumberOfDirectorySeparators(a.moduleSpecifier, b.moduleSpecifier);
148797
148800
  }
@@ -151443,7 +151446,8 @@ var ts;
151443
151446
  insertBefore = ts.findChildOfKind(containingFunction, 98 /* FunctionKeyword */, sourceFile);
151444
151447
  break;
151445
151448
  case 213 /* ArrowFunction */:
151446
- insertBefore = ts.findChildOfKind(containingFunction, 20 /* OpenParenToken */, sourceFile) || ts.first(containingFunction.parameters);
151449
+ var kind = containingFunction.typeParameters ? 29 /* LessThanToken */ : 20 /* OpenParenToken */;
151450
+ insertBefore = ts.findChildOfKind(containingFunction, kind, sourceFile) || ts.first(containingFunction.parameters);
151447
151451
  break;
151448
151452
  default:
151449
151453
  return;
@@ -2747,7 +2747,6 @@ declare namespace ts {
2747
2747
  checkType: Type;
2748
2748
  extendsType: Type;
2749
2749
  isDistributive: boolean;
2750
- isDistributionDependent: boolean;
2751
2750
  inferTypeParameters?: TypeParameter[];
2752
2751
  outerTypeParameters?: TypeParameter[];
2753
2752
  instantiations?: Map<Type>;
package/lib/typescript.js CHANGED
@@ -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-insiders.20211021";
297
+ ts.version = ts.versionMajorMinor + ".0-insiders.20211022";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -20187,7 +20187,7 @@ var ts;
20187
20187
  includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"),
20188
20188
  includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"),
20189
20189
  excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"),
20190
- basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames)
20190
+ basePaths: getBasePaths(absolutePath, includes, useCaseSensitiveFileNames)
20191
20191
  };
20192
20192
  }
20193
20193
  ts.getFileMatcherPatterns = getFileMatcherPatterns;
@@ -20209,20 +20209,20 @@ var ts;
20209
20209
  var visited = new ts.Map();
20210
20210
  var toCanonical = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
20211
20211
  for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
20212
- var basePath = _a[_i];
20213
- if (directoryExists(basePath)) {
20214
- visitDirectory(basePath, ts.combinePaths(currentDirectory, basePath), depth);
20212
+ var absoluteBasePath = _a[_i];
20213
+ if (directoryExists(absoluteBasePath)) {
20214
+ visitDirectory(absoluteBasePath, depth);
20215
20215
  }
20216
20216
  }
20217
20217
  return ts.flatten(results);
20218
- function visitDirectory(path, absolutePath, depth) {
20218
+ function visitDirectory(absolutePath, depth) {
20219
20219
  var canonicalPath = toCanonical(realpath(absolutePath));
20220
20220
  if (visited.has(canonicalPath))
20221
20221
  return;
20222
20222
  visited.set(canonicalPath, true);
20223
- var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;
20223
+ var _a = getFileSystemEntries(absolutePath), files = _a.files, directories = _a.directories;
20224
20224
  var _loop_1 = function (current) {
20225
- var name = ts.combinePaths(path, current);
20225
+ var name = ts.combinePaths(absolutePath, current);
20226
20226
  var absoluteName = ts.combinePaths(absolutePath, current);
20227
20227
  if (extensions && !ts.fileExtensionIsOneOf(name, extensions))
20228
20228
  return "continue";
@@ -20250,11 +20250,10 @@ var ts;
20250
20250
  }
20251
20251
  for (var _c = 0, _d = ts.sort(directories, ts.compareStringsCaseSensitive); _c < _d.length; _c++) {
20252
20252
  var current = _d[_c];
20253
- var name = ts.combinePaths(path, current);
20254
20253
  var absoluteName = ts.combinePaths(absolutePath, current);
20255
20254
  if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
20256
20255
  (!excludeRegex || !excludeRegex.test(absoluteName))) {
20257
- visitDirectory(name, absoluteName, depth);
20256
+ visitDirectory(absoluteName, depth);
20258
20257
  }
20259
20258
  }
20260
20259
  }
@@ -20262,10 +20261,11 @@ var ts;
20262
20261
  ts.matchFiles = matchFiles;
20263
20262
  /**
20264
20263
  * Computes the unique non-wildcard base paths amongst the provided include patterns.
20264
+ * @returns Absolute directory paths
20265
20265
  */
20266
- function getBasePaths(path, includes, useCaseSensitiveFileNames) {
20266
+ function getBasePaths(absoluteTsconfigPath, includes, useCaseSensitiveFileNames) {
20267
20267
  // Storage for our results in the form of literal paths (e.g. the paths as written by the user).
20268
- var basePaths = [path];
20268
+ var basePaths = [absoluteTsconfigPath];
20269
20269
  if (includes) {
20270
20270
  // Storage for literal base paths amongst the include patterns.
20271
20271
  var includeBasePaths = [];
@@ -20273,14 +20273,14 @@ var ts;
20273
20273
  var include = includes_1[_i];
20274
20274
  // We also need to check the relative paths by converting them to absolute and normalizing
20275
20275
  // in case they escape the base path (e.g "..\somedirectory")
20276
- var absolute = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(path, include));
20276
+ var absoluteIncludePath = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(absoluteTsconfigPath, include));
20277
20277
  // Append the literal and canonical candidate base paths.
20278
- includeBasePaths.push(getIncludeBasePath(absolute));
20278
+ includeBasePaths.push(getIncludeBasePath(absoluteIncludePath));
20279
20279
  }
20280
20280
  // Sort the offsets array using either the literal or canonical path representations.
20281
20281
  includeBasePaths.sort(ts.getStringComparer(!useCaseSensitiveFileNames));
20282
20282
  var _loop_2 = function (includeBasePath) {
20283
- if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) {
20283
+ if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, absoluteTsconfigPath, !useCaseSensitiveFileNames); })) {
20284
20284
  basePaths.push(includeBasePath);
20285
20285
  }
20286
20286
  };
@@ -60901,13 +60901,14 @@ var ts;
60901
60901
  }
60902
60902
  return result;
60903
60903
  }
60904
+ function isDistributionDependent(root) {
60905
+ return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
60906
+ isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
60907
+ }
60904
60908
  function getTypeFromConditionalTypeNode(node) {
60905
60909
  var links = getNodeLinks(node);
60906
60910
  if (!links.resolvedType) {
60907
60911
  var checkType = getTypeFromTypeNode(node.checkType);
60908
- var isDistributive = !!(checkType.flags & 262144 /* TypeParameter */);
60909
- var isDistributionDependent = isDistributive && (isTypeParameterPossiblyReferenced(checkType, node.trueType) ||
60910
- isTypeParameterPossiblyReferenced(checkType, node.falseType));
60911
60912
  var aliasSymbol = getAliasSymbolForTypeNode(node);
60912
60913
  var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
60913
60914
  var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
@@ -60916,8 +60917,7 @@ var ts;
60916
60917
  node: node,
60917
60918
  checkType: checkType,
60918
60919
  extendsType: getTypeFromTypeNode(node.extendsType),
60919
- isDistributive: isDistributive,
60920
- isDistributionDependent: isDistributionDependent,
60920
+ isDistributive: !!(checkType.flags & 262144 /* TypeParameter */),
60921
60921
  inferTypeParameters: getInferTypeParameters(node),
60922
60922
  outerTypeParameters: outerTypeParameters,
60923
60923
  instantiations: undefined,
@@ -64064,7 +64064,7 @@ var ts;
64064
64064
  // We check for a relationship to a conditional type target only when the conditional type has no
64065
64065
  // 'infer' positions and is not distributive or is distributive but doesn't reference the check type
64066
64066
  // parameter in either of the result types.
64067
- if (!c.root.inferTypeParameters && !c.root.isDistributionDependent) {
64067
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
64068
64068
  // Check if the conditional is always true or always false but still deferred for distribution purposes.
64069
64069
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
64070
64070
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
@@ -77358,6 +77358,7 @@ var ts;
77358
77358
  var parent = node.parent;
77359
77359
  return ts.isAssertionExpression(parent) && ts.isConstTypeReference(parent.type) ||
77360
77360
  ts.isJSDocTypeAssertion(parent) && ts.isConstTypeReference(ts.getJSDocTypeAssertionType(parent)) ||
77361
+ ts.isComputedPropertyName(parent) ||
77361
77362
  (ts.isParenthesizedExpression(parent) || ts.isArrayLiteralExpression(parent) || ts.isSpreadElement(parent)) && isConstContext(parent) ||
77362
77363
  (ts.isPropertyAssignment(parent) || ts.isShorthandPropertyAssignment(parent) || ts.isTemplateSpan(parent)) && isConstContext(parent.parent);
77363
77364
  }
@@ -148786,12 +148787,14 @@ var ts;
148786
148787
  }
148787
148788
  var allowsImportingSpecifier = ts.createPackageJsonImportFilter(sourceFile, preferences, host).allowsImportingSpecifier;
148788
148789
  return fixes.reduce(function (best, fix) {
148790
+ // Takes true branch of conditional if `fix` is better than `best`
148789
148791
  return compareModuleSpecifiers(fix, best, sourceFile, program, allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
148790
148792
  });
148791
148793
  }
148794
+ /** @returns `Comparison.LessThan` if `a` is better than `b`. */
148792
148795
  function compareModuleSpecifiers(a, b, importingFile, program, allowsImportingSpecifier) {
148793
148796
  if (a.kind !== 0 /* UseNamespace */ && b.kind !== 0 /* UseNamespace */) {
148794
- return ts.compareBooleans(allowsImportingSpecifier(a.moduleSpecifier), allowsImportingSpecifier(b.moduleSpecifier))
148797
+ return ts.compareBooleans(allowsImportingSpecifier(b.moduleSpecifier), allowsImportingSpecifier(a.moduleSpecifier))
148795
148798
  || compareNodeCoreModuleSpecifiers(a.moduleSpecifier, b.moduleSpecifier, importingFile, program)
148796
148799
  || ts.compareNumberOfDirectorySeparators(a.moduleSpecifier, b.moduleSpecifier);
148797
148800
  }
@@ -151443,7 +151446,8 @@ var ts;
151443
151446
  insertBefore = ts.findChildOfKind(containingFunction, 98 /* FunctionKeyword */, sourceFile);
151444
151447
  break;
151445
151448
  case 213 /* ArrowFunction */:
151446
- insertBefore = ts.findChildOfKind(containingFunction, 20 /* OpenParenToken */, sourceFile) || ts.first(containingFunction.parameters);
151449
+ var kind = containingFunction.typeParameters ? 29 /* LessThanToken */ : 20 /* OpenParenToken */;
151450
+ insertBefore = ts.findChildOfKind(containingFunction, kind, sourceFile) || ts.first(containingFunction.parameters);
151447
151451
  break;
151448
151452
  default:
151449
151453
  return;
@@ -2747,7 +2747,6 @@ declare namespace ts {
2747
2747
  checkType: Type;
2748
2748
  extendsType: Type;
2749
2749
  isDistributive: boolean;
2750
- isDistributionDependent: boolean;
2751
2750
  inferTypeParameters?: TypeParameter[];
2752
2751
  outerTypeParameters?: TypeParameter[];
2753
2752
  instantiations?: Map<Type>;
@@ -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-insiders.20211021";
297
+ ts.version = ts.versionMajorMinor + ".0-insiders.20211022";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -20187,7 +20187,7 @@ var ts;
20187
20187
  includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"),
20188
20188
  includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"),
20189
20189
  excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"),
20190
- basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames)
20190
+ basePaths: getBasePaths(absolutePath, includes, useCaseSensitiveFileNames)
20191
20191
  };
20192
20192
  }
20193
20193
  ts.getFileMatcherPatterns = getFileMatcherPatterns;
@@ -20209,20 +20209,20 @@ var ts;
20209
20209
  var visited = new ts.Map();
20210
20210
  var toCanonical = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
20211
20211
  for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
20212
- var basePath = _a[_i];
20213
- if (directoryExists(basePath)) {
20214
- visitDirectory(basePath, ts.combinePaths(currentDirectory, basePath), depth);
20212
+ var absoluteBasePath = _a[_i];
20213
+ if (directoryExists(absoluteBasePath)) {
20214
+ visitDirectory(absoluteBasePath, depth);
20215
20215
  }
20216
20216
  }
20217
20217
  return ts.flatten(results);
20218
- function visitDirectory(path, absolutePath, depth) {
20218
+ function visitDirectory(absolutePath, depth) {
20219
20219
  var canonicalPath = toCanonical(realpath(absolutePath));
20220
20220
  if (visited.has(canonicalPath))
20221
20221
  return;
20222
20222
  visited.set(canonicalPath, true);
20223
- var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;
20223
+ var _a = getFileSystemEntries(absolutePath), files = _a.files, directories = _a.directories;
20224
20224
  var _loop_1 = function (current) {
20225
- var name = ts.combinePaths(path, current);
20225
+ var name = ts.combinePaths(absolutePath, current);
20226
20226
  var absoluteName = ts.combinePaths(absolutePath, current);
20227
20227
  if (extensions && !ts.fileExtensionIsOneOf(name, extensions))
20228
20228
  return "continue";
@@ -20250,11 +20250,10 @@ var ts;
20250
20250
  }
20251
20251
  for (var _c = 0, _d = ts.sort(directories, ts.compareStringsCaseSensitive); _c < _d.length; _c++) {
20252
20252
  var current = _d[_c];
20253
- var name = ts.combinePaths(path, current);
20254
20253
  var absoluteName = ts.combinePaths(absolutePath, current);
20255
20254
  if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
20256
20255
  (!excludeRegex || !excludeRegex.test(absoluteName))) {
20257
- visitDirectory(name, absoluteName, depth);
20256
+ visitDirectory(absoluteName, depth);
20258
20257
  }
20259
20258
  }
20260
20259
  }
@@ -20262,10 +20261,11 @@ var ts;
20262
20261
  ts.matchFiles = matchFiles;
20263
20262
  /**
20264
20263
  * Computes the unique non-wildcard base paths amongst the provided include patterns.
20264
+ * @returns Absolute directory paths
20265
20265
  */
20266
- function getBasePaths(path, includes, useCaseSensitiveFileNames) {
20266
+ function getBasePaths(absoluteTsconfigPath, includes, useCaseSensitiveFileNames) {
20267
20267
  // Storage for our results in the form of literal paths (e.g. the paths as written by the user).
20268
- var basePaths = [path];
20268
+ var basePaths = [absoluteTsconfigPath];
20269
20269
  if (includes) {
20270
20270
  // Storage for literal base paths amongst the include patterns.
20271
20271
  var includeBasePaths = [];
@@ -20273,14 +20273,14 @@ var ts;
20273
20273
  var include = includes_1[_i];
20274
20274
  // We also need to check the relative paths by converting them to absolute and normalizing
20275
20275
  // in case they escape the base path (e.g "..\somedirectory")
20276
- var absolute = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(path, include));
20276
+ var absoluteIncludePath = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(absoluteTsconfigPath, include));
20277
20277
  // Append the literal and canonical candidate base paths.
20278
- includeBasePaths.push(getIncludeBasePath(absolute));
20278
+ includeBasePaths.push(getIncludeBasePath(absoluteIncludePath));
20279
20279
  }
20280
20280
  // Sort the offsets array using either the literal or canonical path representations.
20281
20281
  includeBasePaths.sort(ts.getStringComparer(!useCaseSensitiveFileNames));
20282
20282
  var _loop_2 = function (includeBasePath) {
20283
- if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) {
20283
+ if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, absoluteTsconfigPath, !useCaseSensitiveFileNames); })) {
20284
20284
  basePaths.push(includeBasePath);
20285
20285
  }
20286
20286
  };
@@ -60901,13 +60901,14 @@ var ts;
60901
60901
  }
60902
60902
  return result;
60903
60903
  }
60904
+ function isDistributionDependent(root) {
60905
+ return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
60906
+ isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
60907
+ }
60904
60908
  function getTypeFromConditionalTypeNode(node) {
60905
60909
  var links = getNodeLinks(node);
60906
60910
  if (!links.resolvedType) {
60907
60911
  var checkType = getTypeFromTypeNode(node.checkType);
60908
- var isDistributive = !!(checkType.flags & 262144 /* TypeParameter */);
60909
- var isDistributionDependent = isDistributive && (isTypeParameterPossiblyReferenced(checkType, node.trueType) ||
60910
- isTypeParameterPossiblyReferenced(checkType, node.falseType));
60911
60912
  var aliasSymbol = getAliasSymbolForTypeNode(node);
60912
60913
  var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
60913
60914
  var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
@@ -60916,8 +60917,7 @@ var ts;
60916
60917
  node: node,
60917
60918
  checkType: checkType,
60918
60919
  extendsType: getTypeFromTypeNode(node.extendsType),
60919
- isDistributive: isDistributive,
60920
- isDistributionDependent: isDistributionDependent,
60920
+ isDistributive: !!(checkType.flags & 262144 /* TypeParameter */),
60921
60921
  inferTypeParameters: getInferTypeParameters(node),
60922
60922
  outerTypeParameters: outerTypeParameters,
60923
60923
  instantiations: undefined,
@@ -64064,7 +64064,7 @@ var ts;
64064
64064
  // We check for a relationship to a conditional type target only when the conditional type has no
64065
64065
  // 'infer' positions and is not distributive or is distributive but doesn't reference the check type
64066
64066
  // parameter in either of the result types.
64067
- if (!c.root.inferTypeParameters && !c.root.isDistributionDependent) {
64067
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
64068
64068
  // Check if the conditional is always true or always false but still deferred for distribution purposes.
64069
64069
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
64070
64070
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
@@ -77358,6 +77358,7 @@ var ts;
77358
77358
  var parent = node.parent;
77359
77359
  return ts.isAssertionExpression(parent) && ts.isConstTypeReference(parent.type) ||
77360
77360
  ts.isJSDocTypeAssertion(parent) && ts.isConstTypeReference(ts.getJSDocTypeAssertionType(parent)) ||
77361
+ ts.isComputedPropertyName(parent) ||
77361
77362
  (ts.isParenthesizedExpression(parent) || ts.isArrayLiteralExpression(parent) || ts.isSpreadElement(parent)) && isConstContext(parent) ||
77362
77363
  (ts.isPropertyAssignment(parent) || ts.isShorthandPropertyAssignment(parent) || ts.isTemplateSpan(parent)) && isConstContext(parent.parent);
77363
77364
  }
@@ -148786,12 +148787,14 @@ var ts;
148786
148787
  }
148787
148788
  var allowsImportingSpecifier = ts.createPackageJsonImportFilter(sourceFile, preferences, host).allowsImportingSpecifier;
148788
148789
  return fixes.reduce(function (best, fix) {
148790
+ // Takes true branch of conditional if `fix` is better than `best`
148789
148791
  return compareModuleSpecifiers(fix, best, sourceFile, program, allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
148790
148792
  });
148791
148793
  }
148794
+ /** @returns `Comparison.LessThan` if `a` is better than `b`. */
148792
148795
  function compareModuleSpecifiers(a, b, importingFile, program, allowsImportingSpecifier) {
148793
148796
  if (a.kind !== 0 /* UseNamespace */ && b.kind !== 0 /* UseNamespace */) {
148794
- return ts.compareBooleans(allowsImportingSpecifier(a.moduleSpecifier), allowsImportingSpecifier(b.moduleSpecifier))
148797
+ return ts.compareBooleans(allowsImportingSpecifier(b.moduleSpecifier), allowsImportingSpecifier(a.moduleSpecifier))
148795
148798
  || compareNodeCoreModuleSpecifiers(a.moduleSpecifier, b.moduleSpecifier, importingFile, program)
148796
148799
  || ts.compareNumberOfDirectorySeparators(a.moduleSpecifier, b.moduleSpecifier);
148797
148800
  }
@@ -151443,7 +151446,8 @@ var ts;
151443
151446
  insertBefore = ts.findChildOfKind(containingFunction, 98 /* FunctionKeyword */, sourceFile);
151444
151447
  break;
151445
151448
  case 213 /* ArrowFunction */:
151446
- insertBefore = ts.findChildOfKind(containingFunction, 20 /* OpenParenToken */, sourceFile) || ts.first(containingFunction.parameters);
151449
+ var kind = containingFunction.typeParameters ? 29 /* LessThanToken */ : 20 /* OpenParenToken */;
151450
+ insertBefore = ts.findChildOfKind(containingFunction, kind, sourceFile) || ts.first(containingFunction.parameters);
151447
151451
  break;
151448
151452
  default:
151449
151453
  return;
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-insiders.20211021";
92
+ ts.version = ts.versionMajorMinor + ".0-insiders.20211022";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -19982,7 +19982,7 @@ var ts;
19982
19982
  includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"),
19983
19983
  includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"),
19984
19984
  excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"),
19985
- basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames)
19985
+ basePaths: getBasePaths(absolutePath, includes, useCaseSensitiveFileNames)
19986
19986
  };
19987
19987
  }
19988
19988
  ts.getFileMatcherPatterns = getFileMatcherPatterns;
@@ -20004,20 +20004,20 @@ var ts;
20004
20004
  var visited = new ts.Map();
20005
20005
  var toCanonical = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
20006
20006
  for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
20007
- var basePath = _a[_i];
20008
- if (directoryExists(basePath)) {
20009
- visitDirectory(basePath, ts.combinePaths(currentDirectory, basePath), depth);
20007
+ var absoluteBasePath = _a[_i];
20008
+ if (directoryExists(absoluteBasePath)) {
20009
+ visitDirectory(absoluteBasePath, depth);
20010
20010
  }
20011
20011
  }
20012
20012
  return ts.flatten(results);
20013
- function visitDirectory(path, absolutePath, depth) {
20013
+ function visitDirectory(absolutePath, depth) {
20014
20014
  var canonicalPath = toCanonical(realpath(absolutePath));
20015
20015
  if (visited.has(canonicalPath))
20016
20016
  return;
20017
20017
  visited.set(canonicalPath, true);
20018
- var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;
20018
+ var _a = getFileSystemEntries(absolutePath), files = _a.files, directories = _a.directories;
20019
20019
  var _loop_1 = function (current) {
20020
- var name = ts.combinePaths(path, current);
20020
+ var name = ts.combinePaths(absolutePath, current);
20021
20021
  var absoluteName = ts.combinePaths(absolutePath, current);
20022
20022
  if (extensions && !ts.fileExtensionIsOneOf(name, extensions))
20023
20023
  return "continue";
@@ -20045,11 +20045,10 @@ var ts;
20045
20045
  }
20046
20046
  for (var _c = 0, _d = ts.sort(directories, ts.compareStringsCaseSensitive); _c < _d.length; _c++) {
20047
20047
  var current = _d[_c];
20048
- var name = ts.combinePaths(path, current);
20049
20048
  var absoluteName = ts.combinePaths(absolutePath, current);
20050
20049
  if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
20051
20050
  (!excludeRegex || !excludeRegex.test(absoluteName))) {
20052
- visitDirectory(name, absoluteName, depth);
20051
+ visitDirectory(absoluteName, depth);
20053
20052
  }
20054
20053
  }
20055
20054
  }
@@ -20057,10 +20056,11 @@ var ts;
20057
20056
  ts.matchFiles = matchFiles;
20058
20057
  /**
20059
20058
  * Computes the unique non-wildcard base paths amongst the provided include patterns.
20059
+ * @returns Absolute directory paths
20060
20060
  */
20061
- function getBasePaths(path, includes, useCaseSensitiveFileNames) {
20061
+ function getBasePaths(absoluteTsconfigPath, includes, useCaseSensitiveFileNames) {
20062
20062
  // Storage for our results in the form of literal paths (e.g. the paths as written by the user).
20063
- var basePaths = [path];
20063
+ var basePaths = [absoluteTsconfigPath];
20064
20064
  if (includes) {
20065
20065
  // Storage for literal base paths amongst the include patterns.
20066
20066
  var includeBasePaths = [];
@@ -20068,14 +20068,14 @@ var ts;
20068
20068
  var include = includes_1[_i];
20069
20069
  // We also need to check the relative paths by converting them to absolute and normalizing
20070
20070
  // in case they escape the base path (e.g "..\somedirectory")
20071
- var absolute = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(path, include));
20071
+ var absoluteIncludePath = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(absoluteTsconfigPath, include));
20072
20072
  // Append the literal and canonical candidate base paths.
20073
- includeBasePaths.push(getIncludeBasePath(absolute));
20073
+ includeBasePaths.push(getIncludeBasePath(absoluteIncludePath));
20074
20074
  }
20075
20075
  // Sort the offsets array using either the literal or canonical path representations.
20076
20076
  includeBasePaths.sort(ts.getStringComparer(!useCaseSensitiveFileNames));
20077
20077
  var _loop_2 = function (includeBasePath) {
20078
- if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) {
20078
+ if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, absoluteTsconfigPath, !useCaseSensitiveFileNames); })) {
20079
20079
  basePaths.push(includeBasePath);
20080
20080
  }
20081
20081
  };
@@ -60696,13 +60696,14 @@ var ts;
60696
60696
  }
60697
60697
  return result;
60698
60698
  }
60699
+ function isDistributionDependent(root) {
60700
+ return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
60701
+ isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
60702
+ }
60699
60703
  function getTypeFromConditionalTypeNode(node) {
60700
60704
  var links = getNodeLinks(node);
60701
60705
  if (!links.resolvedType) {
60702
60706
  var checkType = getTypeFromTypeNode(node.checkType);
60703
- var isDistributive = !!(checkType.flags & 262144 /* TypeParameter */);
60704
- var isDistributionDependent = isDistributive && (isTypeParameterPossiblyReferenced(checkType, node.trueType) ||
60705
- isTypeParameterPossiblyReferenced(checkType, node.falseType));
60706
60707
  var aliasSymbol = getAliasSymbolForTypeNode(node);
60707
60708
  var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
60708
60709
  var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
@@ -60711,8 +60712,7 @@ var ts;
60711
60712
  node: node,
60712
60713
  checkType: checkType,
60713
60714
  extendsType: getTypeFromTypeNode(node.extendsType),
60714
- isDistributive: isDistributive,
60715
- isDistributionDependent: isDistributionDependent,
60715
+ isDistributive: !!(checkType.flags & 262144 /* TypeParameter */),
60716
60716
  inferTypeParameters: getInferTypeParameters(node),
60717
60717
  outerTypeParameters: outerTypeParameters,
60718
60718
  instantiations: undefined,
@@ -63859,7 +63859,7 @@ var ts;
63859
63859
  // We check for a relationship to a conditional type target only when the conditional type has no
63860
63860
  // 'infer' positions and is not distributive or is distributive but doesn't reference the check type
63861
63861
  // parameter in either of the result types.
63862
- if (!c.root.inferTypeParameters && !c.root.isDistributionDependent) {
63862
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
63863
63863
  // Check if the conditional is always true or always false but still deferred for distribution purposes.
63864
63864
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
63865
63865
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
@@ -77153,6 +77153,7 @@ var ts;
77153
77153
  var parent = node.parent;
77154
77154
  return ts.isAssertionExpression(parent) && ts.isConstTypeReference(parent.type) ||
77155
77155
  ts.isJSDocTypeAssertion(parent) && ts.isConstTypeReference(ts.getJSDocTypeAssertionType(parent)) ||
77156
+ ts.isComputedPropertyName(parent) ||
77156
77157
  (ts.isParenthesizedExpression(parent) || ts.isArrayLiteralExpression(parent) || ts.isSpreadElement(parent)) && isConstContext(parent) ||
77157
77158
  (ts.isPropertyAssignment(parent) || ts.isShorthandPropertyAssignment(parent) || ts.isTemplateSpan(parent)) && isConstContext(parent.parent);
77158
77159
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.5.0-pr-46429-36",
5
+ "version": "4.5.0-pr-46464-7",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [