typescript 4.8.0-dev.20220807 → 4.9.0-dev.20220811

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
@@ -68,8 +68,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
68
68
  };
69
69
  var ts;
70
70
  (function (ts) {
71
- ts.versionMajorMinor = "4.8";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220807";
71
+ ts.versionMajorMinor = "4.9";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220811";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -78,24 +78,25 @@ var ts;
78
78
  undefined;
79
79
  function tryGetNativeMap() {
80
80
  var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
81
- return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
81
+ var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
82
+ if (!constructor) {
83
+ throw new Error("No compatible Map implementation found.");
84
+ }
85
+ return constructor;
82
86
  }
83
87
  NativeCollections.tryGetNativeMap = tryGetNativeMap;
84
88
  function tryGetNativeSet() {
85
89
  var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
86
- return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
90
+ var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
91
+ if (!constructor) {
92
+ throw new Error("No compatible Set implementation found.");
93
+ }
94
+ return constructor;
87
95
  }
88
96
  NativeCollections.tryGetNativeSet = tryGetNativeSet;
89
97
  })(NativeCollections || (NativeCollections = {}));
90
- ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim");
91
- ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim");
92
- function getCollectionImplementation(name, nativeFactory, shimFactory) {
93
- var _a;
94
- var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator);
95
- if (constructor)
96
- return constructor;
97
- throw new Error("TypeScript requires an environment that provides a compatible native " + name + " implementation.");
98
- }
98
+ ts.Map = NativeCollections.tryGetNativeMap();
99
+ ts.Set = NativeCollections.tryGetNativeSet();
99
100
  })(ts || (ts = {}));
100
101
  var ts;
101
102
  (function (ts) {
@@ -759,15 +760,18 @@ var ts;
759
760
  function insertSorted(array, insert, compare, allowDuplicates) {
760
761
  if (array.length === 0) {
761
762
  array.push(insert);
762
- return;
763
+ return true;
763
764
  }
764
765
  var insertIndex = binarySearch(array, insert, identity, compare);
765
766
  if (insertIndex < 0) {
766
767
  array.splice(~insertIndex, 0, insert);
768
+ return true;
767
769
  }
768
- else if (allowDuplicates) {
770
+ if (allowDuplicates) {
769
771
  array.splice(insertIndex, 0, insert);
772
+ return true;
770
773
  }
774
+ return false;
771
775
  }
772
776
  ts.insertSorted = insertSorted;
773
777
  function sortAndDeduplicate(array, comparer, equalityComparer) {
@@ -5078,12 +5082,9 @@ var ts;
5078
5082
  }
5079
5083
  ts.getPathFromPathComponents = getPathFromPathComponents;
5080
5084
  function normalizeSlashes(path) {
5081
- var index = path.indexOf("\\");
5082
- if (index === -1) {
5083
- return path;
5084
- }
5085
- backslashRegExp.lastIndex = index;
5086
- return path.replace(backslashRegExp, ts.directorySeparator);
5085
+ return path.indexOf("\\") !== -1
5086
+ ? path.replace(backslashRegExp, ts.directorySeparator)
5087
+ : path;
5087
5088
  }
5088
5089
  ts.normalizeSlashes = normalizeSlashes;
5089
5090
  function reducePathComponents(components) {
@@ -6704,6 +6705,7 @@ var ts;
6704
6705
  Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."),
6705
6706
  Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"),
6706
6707
  Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"),
6708
+ Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"),
6707
6709
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
6708
6710
  The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
6709
6711
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -15279,20 +15281,16 @@ var ts;
15279
15281
  return getStringFromExpandedCharCodes(expandedCharCodes);
15280
15282
  }
15281
15283
  ts.base64decode = base64decode;
15284
+ function readJsonOrUndefined(path, hostOrText) {
15285
+ var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path);
15286
+ if (!jsonText)
15287
+ return undefined;
15288
+ var result = ts.parseConfigFileTextToJson(path, jsonText);
15289
+ return !result.error ? result.config : undefined;
15290
+ }
15291
+ ts.readJsonOrUndefined = readJsonOrUndefined;
15282
15292
  function readJson(path, host) {
15283
- try {
15284
- var jsonText = host.readFile(path);
15285
- if (!jsonText)
15286
- return {};
15287
- var result = ts.parseConfigFileTextToJson(path, jsonText);
15288
- if (result.error) {
15289
- return {};
15290
- }
15291
- return result.config;
15292
- }
15293
- catch (e) {
15294
- return {};
15295
- }
15293
+ return readJsonOrUndefined(path, host) || {};
15296
15294
  }
15297
15295
  ts.readJson = readJson;
15298
15296
  function directoryProbablyExists(directoryName, host) {
@@ -22352,9 +22350,10 @@ var ts;
22352
22350
  };
22353
22351
  var buildInfo_1;
22354
22352
  var getAndCacheBuildInfo_1 = function (getText) {
22353
+ var _a;
22355
22354
  if (buildInfo_1 === undefined) {
22356
22355
  var result = getText();
22357
- buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false;
22356
+ buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false;
22358
22357
  }
22359
22358
  return buildInfo_1 || undefined;
22360
22359
  };
@@ -37498,6 +37497,9 @@ var ts;
37498
37497
  case 203:
37499
37498
  bindBindingElementFlow(node);
37500
37499
  break;
37500
+ case 164:
37501
+ bindParameterFlow(node);
37502
+ break;
37501
37503
  case 205:
37502
37504
  case 204:
37503
37505
  case 296:
@@ -38192,15 +38194,32 @@ var ts;
38192
38194
  }
38193
38195
  }
38194
38196
  function bindBindingElementFlow(node) {
38195
- if (ts.isBindingPattern(node.name)) {
38196
- bind(node.dotDotDotToken);
38197
- bind(node.propertyName);
38198
- bind(node.initializer);
38199
- bind(node.name);
38197
+ bind(node.dotDotDotToken);
38198
+ bind(node.propertyName);
38199
+ bindInitializer(node.initializer);
38200
+ bind(node.name);
38201
+ }
38202
+ function bindParameterFlow(node) {
38203
+ bindEach(node.modifiers);
38204
+ bind(node.dotDotDotToken);
38205
+ bind(node.questionToken);
38206
+ bind(node.type);
38207
+ bindInitializer(node.initializer);
38208
+ bind(node.name);
38209
+ }
38210
+ function bindInitializer(node) {
38211
+ if (!node) {
38212
+ return;
38200
38213
  }
38201
- else {
38202
- bindEachChild(node);
38214
+ var entryFlow = currentFlow;
38215
+ bind(node);
38216
+ if (entryFlow === unreachableFlow || entryFlow === currentFlow) {
38217
+ return;
38203
38218
  }
38219
+ var exitFlow = createBranchLabel();
38220
+ addAntecedent(exitFlow, entryFlow);
38221
+ addAntecedent(exitFlow, currentFlow);
38222
+ currentFlow = finishFlowLabel(exitFlow);
38204
38223
  }
38205
38224
  function bindJSDocTypeAlias(node) {
38206
38225
  bind(node.tagName);
@@ -40846,7 +40865,7 @@ var ts;
40846
40865
  if (unidirectional === void 0) { unidirectional = false; }
40847
40866
  source.forEach(function (sourceSymbol, id) {
40848
40867
  var targetSymbol = target.get(id);
40849
- target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol);
40868
+ target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol));
40850
40869
  });
40851
40870
  }
40852
40871
  function mergeModuleAugmentation(moduleName) {
@@ -46698,11 +46717,9 @@ var ts;
46698
46717
  return getReturnTypeOfSignature(getterSignature);
46699
46718
  }
46700
46719
  }
46701
- if (ts.isInJSFile(declaration)) {
46702
- var type_1 = getParameterTypeOfTypeTag(func, declaration);
46703
- if (type_1)
46704
- return type_1;
46705
- }
46720
+ var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration);
46721
+ if (parameterTypeOfTypeTag)
46722
+ return parameterTypeOfTypeTag;
46706
46723
  var type = declaration.symbol.escapedName === "this" ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
46707
46724
  if (type) {
46708
46725
  return addOptionality(type, false, isOptional);
@@ -47207,8 +47224,8 @@ var ts;
47207
47224
  if (typeNode === undefined) {
47208
47225
  return useUnknownInCatchVariables ? unknownType : anyType;
47209
47226
  }
47210
- var type_2 = getTypeOfNode(typeNode);
47211
- return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType;
47227
+ var type_1 = getTypeOfNode(typeNode);
47228
+ return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType;
47212
47229
  }
47213
47230
  if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
47214
47231
  if (!declaration.statements.length) {
@@ -47405,11 +47422,11 @@ var ts;
47405
47422
  return errorType;
47406
47423
  }
47407
47424
  var exportEquals = getMergedSymbol(symbol.exports.get("export="));
47408
- var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
47425
+ var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
47409
47426
  if (!popTypeResolution()) {
47410
47427
  return reportCircularityError(symbol);
47411
47428
  }
47412
- return type_3;
47429
+ return type_2;
47413
47430
  }
47414
47431
  }
47415
47432
  var type = createObjectType(16, symbol);
@@ -49335,10 +49352,10 @@ var ts;
49335
49352
  var baseTypes = [];
49336
49353
  var different = false;
49337
49354
  for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {
49338
- var type_4 = types_7[_i];
49339
- var baseType = getBaseConstraint(type_4);
49355
+ var type_3 = types_7[_i];
49356
+ var baseType = getBaseConstraint(type_3);
49340
49357
  if (baseType) {
49341
- if (baseType !== type_4) {
49358
+ if (baseType !== type_3) {
49342
49359
  different = true;
49343
49360
  }
49344
49361
  baseTypes.push(baseType);
@@ -50019,7 +50036,10 @@ var ts;
50019
50036
  continue;
50020
50037
  }
50021
50038
  }
50022
- result.push(getSignatureFromDeclaration(decl));
50039
+ result.push((!ts.isFunctionExpressionOrArrowFunction(decl) &&
50040
+ !ts.isObjectLiteralMethod(decl) &&
50041
+ getSignatureOfTypeTag(decl)) ||
50042
+ getSignatureFromDeclaration(decl));
50023
50043
  }
50024
50044
  return result;
50025
50045
  }
@@ -50050,7 +50070,7 @@ var ts;
50050
50070
  else {
50051
50071
  var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
50052
50072
  var jsdocPredicate = void 0;
50053
- if (!type && ts.isInJSFile(signature.declaration)) {
50073
+ if (!type) {
50054
50074
  var jsdocSignature = getSignatureOfTypeTag(signature.declaration);
50055
50075
  if (jsdocSignature && signature !== jsdocSignature) {
50056
50076
  jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
@@ -53643,14 +53663,13 @@ var ts;
53643
53663
  return false;
53644
53664
  }
53645
53665
  function isContextSensitiveFunctionLikeDeclaration(node) {
53646
- return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) &&
53647
- (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node));
53666
+ return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
53648
53667
  }
53649
53668
  function hasContextSensitiveReturnExpression(node) {
53650
53669
  return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 && isContextSensitive(node.body);
53651
53670
  }
53652
53671
  function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
53653
- return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
53672
+ return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
53654
53673
  isContextSensitiveFunctionLikeDeclaration(func);
53655
53674
  }
53656
53675
  function getTypeWithoutSignatures(type) {
@@ -61414,8 +61433,11 @@ var ts;
61414
61433
  case 1:
61415
61434
  case 6:
61416
61435
  case 3:
61417
- var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
61418
61436
  case 2:
61437
+ var valueDeclaration = void 0;
61438
+ if (kind !== 2) {
61439
+ valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
61440
+ }
61419
61441
  valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration);
61420
61442
  var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration);
61421
61443
  return annotated ? getTypeFromTypeNode(annotated) : undefined;
@@ -61824,9 +61846,18 @@ var ts;
61824
61846
  if (!isErrorType(intrinsicClassAttribs)) {
61825
61847
  var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);
61826
61848
  var hostClassType = getReturnTypeOfSignature(sig);
61827
- apparentAttributesType = intersectTypes(typeParams
61828
- ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)))
61829
- : intrinsicClassAttribs, apparentAttributesType);
61849
+ var libraryManagedAttributeType = void 0;
61850
+ if (typeParams && typeParams.length === 1) {
61851
+ var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context));
61852
+ libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs));
61853
+ }
61854
+ else if (typeParams)
61855
+ libraryManagedAttributeType = undefined;
61856
+ else
61857
+ libraryManagedAttributeType = intrinsicClassAttribs;
61858
+ if (libraryManagedAttributeType) {
61859
+ apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType);
61860
+ }
61830
61861
  }
61831
61862
  var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
61832
61863
  if (!isErrorType(intrinsicAttribs)) {
@@ -62272,15 +62303,26 @@ var ts;
62272
62303
  }
62273
62304
  propertiesArray.push(member);
62274
62305
  }
62275
- if (contextualTypeHasPattern && node.parent.kind !== 298) {
62276
- for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) {
62277
- var prop = _e[_d];
62278
- if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
62279
- if (!(prop.flags & 16777216)) {
62280
- error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
62306
+ if (contextualTypeHasPattern) {
62307
+ var rootPatternParent_1 = ts.findAncestor(contextualType.pattern.parent, function (n) {
62308
+ return n.kind === 254 ||
62309
+ n.kind === 221 ||
62310
+ n.kind === 164;
62311
+ });
62312
+ var spreadOrOutsideRootObject = ts.findAncestor(node, function (n) {
62313
+ return n === rootPatternParent_1 ||
62314
+ n.kind === 298;
62315
+ });
62316
+ if (spreadOrOutsideRootObject.kind !== 298) {
62317
+ for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) {
62318
+ var prop = _e[_d];
62319
+ if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
62320
+ if (!(prop.flags & 16777216)) {
62321
+ error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
62322
+ }
62323
+ propertiesTable.set(prop.escapedName, prop);
62324
+ propertiesArray.push(prop);
62281
62325
  }
62282
- propertiesTable.set(prop.escapedName, prop);
62283
- propertiesArray.push(prop);
62284
62326
  }
62285
62327
  }
62286
62328
  }
@@ -65032,11 +65074,13 @@ var ts;
65032
65074
  return false;
65033
65075
  }
65034
65076
  var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
65035
- ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
65077
+ (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
65036
65078
  undefined;
65037
65079
  if (func) {
65038
65080
  if (ts.getJSDocClassTag(node))
65039
65081
  return true;
65082
+ if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent)))
65083
+ return false;
65040
65084
  var symbol = getSymbolOfNode(func);
65041
65085
  return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size);
65042
65086
  }
@@ -65268,8 +65312,8 @@ var ts;
65268
65312
  if (hasDefaultOnly && type && !isErrorType(type)) {
65269
65313
  var synthType = type;
65270
65314
  if (!synthType.defaultOnlyType) {
65271
- var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
65272
- synthType.defaultOnlyType = type_5;
65315
+ var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
65316
+ synthType.defaultOnlyType = type_4;
65273
65317
  }
65274
65318
  return synthType.defaultOnlyType;
65275
65319
  }
@@ -73393,6 +73437,12 @@ var ts;
73393
73437
  return resolveJSDocMemberName(name, false, getSymbolOfNode(container));
73394
73438
  }
73395
73439
  }
73440
+ if (result && isJSDoc_1) {
73441
+ var container = ts.getJSDocHost(name);
73442
+ if (container && ts.isEnumMember(container) && container === result.valueDeclaration) {
73443
+ return resolveEntityName(name, meaning, true, true, ts.getSourceFileOfNode(container)) || result;
73444
+ }
73445
+ }
73396
73446
  return result;
73397
73447
  }
73398
73448
  else if (ts.isPrivateIdentifier(name)) {
@@ -88476,6 +88526,12 @@ var ts;
88476
88526
  case 265:
88477
88527
  ts.Debug.assert(importVariableName !== undefined);
88478
88528
  statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName)));
88529
+ if (ts.hasSyntacticModifier(entry, 1)) {
88530
+ statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, undefined, [
88531
+ factory.createStringLiteral(ts.idText(importVariableName)),
88532
+ parameterName,
88533
+ ])));
88534
+ }
88479
88535
  break;
88480
88536
  case 272:
88481
88537
  ts.Debug.assert(importVariableName !== undefined);
@@ -90717,8 +90773,12 @@ var ts;
90717
90773
  }
90718
90774
  var previousNeedsDeclare = needsDeclare;
90719
90775
  switch (input.kind) {
90720
- case 259:
90721
- return cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
90776
+ case 259: {
90777
+ needsDeclare = false;
90778
+ var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
90779
+ needsDeclare = previousNeedsDeclare;
90780
+ return clean;
90781
+ }
90722
90782
  case 258: {
90723
90783
  return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree)));
90724
90784
  }
@@ -92027,8 +92087,8 @@ var ts;
92027
92087
  return JSON.stringify(buildInfo);
92028
92088
  }
92029
92089
  ts.getBuildInfoText = getBuildInfoText;
92030
- function getBuildInfo(buildInfoText) {
92031
- return JSON.parse(buildInfoText);
92090
+ function getBuildInfo(buildInfoFile, buildInfoText) {
92091
+ return ts.readJsonOrUndefined(buildInfoFile, buildInfoText);
92032
92092
  }
92033
92093
  ts.getBuildInfo = getBuildInfo;
92034
92094
  ts.notImplementedResolver = {
@@ -92102,17 +92162,16 @@ var ts;
92102
92162
  var _a = getOutputPathsForBundle(config.options, false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
92103
92163
  var buildInfo;
92104
92164
  if (host.getBuildInfo) {
92105
- var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
92106
- if (!hostBuildInfo)
92107
- return buildInfoPath;
92108
- buildInfo = hostBuildInfo;
92165
+ buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
92109
92166
  }
92110
92167
  else {
92111
92168
  var buildInfoText = host.readFile(buildInfoPath);
92112
92169
  if (!buildInfoText)
92113
92170
  return buildInfoPath;
92114
- buildInfo = getBuildInfo(buildInfoText);
92171
+ buildInfo = getBuildInfo(buildInfoPath, buildInfoText);
92115
92172
  }
92173
+ if (!buildInfo)
92174
+ return buildInfoPath;
92116
92175
  if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
92117
92176
  return buildInfoPath;
92118
92177
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
@@ -96356,7 +96415,15 @@ var ts;
96356
96415
  return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath));
96357
96416
  }
96358
96417
  function getCachedFileSystemEntriesForBaseDir(path) {
96359
- return getCachedFileSystemEntries(ts.getDirectoryPath(path));
96418
+ var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path));
96419
+ if (!entries) {
96420
+ return entries;
96421
+ }
96422
+ if (!entries.sortedAndCanonicalizedFiles) {
96423
+ entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort();
96424
+ entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort();
96425
+ }
96426
+ return entries;
96360
96427
  }
96361
96428
  function getBaseNameOfFileName(fileName) {
96362
96429
  return ts.getBaseFileName(ts.normalizePath(fileName));
@@ -96391,21 +96458,9 @@ var ts;
96391
96458
  return undefined;
96392
96459
  }
96393
96460
  }
96394
- function fileNameEqual(name1, name2) {
96395
- return getCanonicalFileName(name1) === getCanonicalFileName(name2);
96396
- }
96397
96461
  function hasEntry(entries, name) {
96398
- return ts.some(entries, function (file) { return fileNameEqual(file, name); });
96399
- }
96400
- function updateFileSystemEntry(entries, baseName, isValid) {
96401
- if (hasEntry(entries, baseName)) {
96402
- if (!isValid) {
96403
- return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); });
96404
- }
96405
- }
96406
- else if (isValid) {
96407
- return entries.push(baseName);
96408
- }
96462
+ var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive);
96463
+ return index >= 0;
96409
96464
  }
96410
96465
  function writeFile(fileName, data, writeByteOrderMark) {
96411
96466
  var path = toPath(fileName);
@@ -96418,7 +96473,7 @@ var ts;
96418
96473
  function fileExists(fileName) {
96419
96474
  var path = toPath(fileName);
96420
96475
  var result = getCachedFileSystemEntriesForBaseDir(path);
96421
- return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) ||
96476
+ return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) ||
96422
96477
  host.fileExists(fileName);
96423
96478
  }
96424
96479
  function directoryExists(dirPath) {
@@ -96428,9 +96483,13 @@ var ts;
96428
96483
  function createDirectory(dirPath) {
96429
96484
  var path = toPath(dirPath);
96430
96485
  var result = getCachedFileSystemEntriesForBaseDir(path);
96431
- var baseFileName = getBaseNameOfFileName(dirPath);
96432
96486
  if (result) {
96433
- updateFileSystemEntry(result.directories, baseFileName, true);
96487
+ var baseName = getBaseNameOfFileName(dirPath);
96488
+ var canonicalizedBaseName = getCanonicalFileName(baseName);
96489
+ var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories;
96490
+ if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) {
96491
+ result.directories.push(baseName);
96492
+ }
96434
96493
  }
96435
96494
  host.createDirectory(dirPath);
96436
96495
  }
@@ -96494,7 +96553,7 @@ var ts;
96494
96553
  fileExists: host.fileExists(fileOrDirectoryPath),
96495
96554
  directoryExists: host.directoryExists(fileOrDirectoryPath)
96496
96555
  };
96497
- if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) {
96556
+ if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
96498
96557
  clearCache();
96499
96558
  }
96500
96559
  else {
@@ -96512,7 +96571,21 @@ var ts;
96512
96571
  }
96513
96572
  }
96514
96573
  function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) {
96515
- updateFileSystemEntry(parentResult.files, baseName, fileExists);
96574
+ var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles;
96575
+ var canonicalizedBaseName = getCanonicalFileName(baseName);
96576
+ if (fileExists) {
96577
+ if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) {
96578
+ parentResult.files.push(baseName);
96579
+ }
96580
+ }
96581
+ else {
96582
+ var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive);
96583
+ if (sortedIndex >= 0) {
96584
+ canonicalizedFiles.splice(sortedIndex, 1);
96585
+ var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; });
96586
+ parentResult.files.splice(unsortedIndex, 1);
96587
+ }
96588
+ }
96516
96589
  }
96517
96590
  function clearCache() {
96518
96591
  cachedReadDirectoryResult.clear();
@@ -103666,18 +103739,14 @@ var ts;
103666
103739
  var buildInfo;
103667
103740
  if (host.getBuildInfo) {
103668
103741
  buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
103669
- if (!buildInfo)
103670
- return undefined;
103671
103742
  }
103672
103743
  else {
103673
103744
  var content = host.readFile(buildInfoPath);
103674
103745
  if (!content)
103675
103746
  return undefined;
103676
- buildInfo = ts.getBuildInfo(content);
103747
+ buildInfo = ts.getBuildInfo(buildInfoPath, content);
103677
103748
  }
103678
- if (buildInfo.version !== ts.version)
103679
- return undefined;
103680
- if (!buildInfo.program)
103749
+ if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program)
103681
103750
  return undefined;
103682
103751
  return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
103683
103752
  }
@@ -103890,7 +103959,8 @@ var ts;
103890
103959
  }
103891
103960
  }
103892
103961
  var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
103893
- if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
103962
+ var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
103963
+ if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
103894
103964
  if (hasChangedConfigFileParsingErrors) {
103895
103965
  if (reportFileChangeDetectedOnCreateProgram) {
103896
103966
  reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
@@ -103909,6 +103979,11 @@ var ts;
103909
103979
  if (host.afterProgramCreate && program !== builderProgram) {
103910
103980
  host.afterProgramCreate(builderProgram);
103911
103981
  }
103982
+ compilerHost.readFile = originalReadFile;
103983
+ compilerHost.fileExists = originalFileExists;
103984
+ compilerHost.directoryExists = originalDirectoryExists;
103985
+ compilerHost.createDirectory = originalCreateDirectory;
103986
+ compilerHost.writeFile = originalWriteFile;
103912
103987
  return builderProgram;
103913
103988
  }
103914
103989
  function createNewProgram(hasInvalidatedResolution) {
@@ -104328,16 +104403,17 @@ var ts;
104328
104403
  UpToDateStatusType[UpToDateStatusType["UpToDateWithUpstreamTypes"] = 2] = "UpToDateWithUpstreamTypes";
104329
104404
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend";
104330
104405
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
104331
- UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
104332
- UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
104333
- UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
104334
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
104335
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
104336
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
104337
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
104338
- UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
104339
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
104340
- UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
104406
+ UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile";
104407
+ UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf";
104408
+ UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream";
104409
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo";
104410
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate";
104411
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked";
104412
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream";
104413
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate";
104414
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText";
104415
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly";
104416
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild";
104341
104417
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
104342
104418
  function resolveConfigFileProjectName(project) {
104343
104419
  if (ts.fileExtensionIs(project, ".json")) {
@@ -105002,13 +105078,13 @@ var ts;
105002
105078
  var emitterDiagnostics = ts.createDiagnosticCollection();
105003
105079
  var emittedOutputs = new ts.Map();
105004
105080
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
105005
- var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
105081
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined;
105006
105082
  outputFiles.forEach(function (_a) {
105007
105083
  var _b, _c;
105008
105084
  var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
105009
105085
  emittedOutputs.set(toPath(state, name), name);
105010
105086
  if (buildInfo) {
105011
- if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
105087
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
105012
105088
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
105013
105089
  }
105014
105090
  setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
@@ -105291,8 +105367,7 @@ var ts;
105291
105367
  return existing.buildInfo || undefined;
105292
105368
  }
105293
105369
  var value = state.readFileWithCache(buildInfoPath);
105294
- var buildInfo = value ? ts.getBuildInfo(value) : undefined;
105295
- ts.Debug.assert(modifiedTime || !buildInfo);
105370
+ var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined;
105296
105371
  state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
105297
105372
  return buildInfo;
105298
105373
  }
@@ -105370,7 +105445,13 @@ var ts;
105370
105445
  missingOutputFileName: buildInfoPath
105371
105446
  };
105372
105447
  }
105373
- var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
105448
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime);
105449
+ if (!buildInfo) {
105450
+ return {
105451
+ type: ts.UpToDateStatusType.ErrorReadingFile,
105452
+ fileName: buildInfoPath
105453
+ };
105454
+ }
105374
105455
  if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
105375
105456
  return {
105376
105457
  type: ts.UpToDateStatusType.TsVersionOutputOfDate,
@@ -105978,6 +106059,8 @@ var ts;
105978
106059
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName));
105979
106060
  case ts.UpToDateStatusType.OutputMissing:
105980
106061
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName));
106062
+ case ts.UpToDateStatusType.ErrorReadingFile:
106063
+ return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName));
105981
106064
  case ts.UpToDateStatusType.OutOfDateBuildInfo:
105982
106065
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile));
105983
106066
  case ts.UpToDateStatusType.UpToDate: