typescript 4.8.3 → 4.8.4

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.
@@ -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 = "4.8.3";
92
+ ts.version = "4.8.4";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -31496,6 +31496,7 @@ var ts;
31496
31496
  case 335 /* SyntaxKind.JSDocProtectedTag */:
31497
31497
  case 336 /* SyntaxKind.JSDocReadonlyTag */:
31498
31498
  case 331 /* SyntaxKind.JSDocDeprecatedTag */:
31499
+ case 337 /* SyntaxKind.JSDocOverrideTag */:
31499
31500
  return visitNode(cbNode, node.tagName)
31500
31501
  || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
31501
31502
  case 350 /* SyntaxKind.PartiallyEmittedExpression */:
@@ -42784,7 +42785,7 @@ var ts;
42784
42785
  function withPackageId(packageInfo, r) {
42785
42786
  var packageId;
42786
42787
  if (r && packageInfo) {
42787
- var packageJsonContent = packageInfo.packageJsonContent;
42788
+ var packageJsonContent = packageInfo.contents.packageJsonContent;
42788
42789
  if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") {
42789
42790
  packageId = {
42790
42791
  name: packageJsonContent.name,
@@ -44103,16 +44104,16 @@ var ts;
44103
44104
  function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
44104
44105
  if (considerPackageJson === void 0) { considerPackageJson = true; }
44105
44106
  var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined;
44106
- var packageJsonContent = packageInfo && packageInfo.packageJsonContent;
44107
- var versionPaths = packageInfo && packageInfo.versionPaths;
44107
+ var packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent;
44108
+ var versionPaths = packageInfo && packageInfo.contents.versionPaths;
44108
44109
  return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
44109
44110
  }
44110
44111
  /* @internal */
44111
44112
  function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) {
44112
- if (!resolveJs && packageJsonInfo.resolvedEntrypoints !== undefined) {
44113
+ if (!resolveJs && packageJsonInfo.contents.resolvedEntrypoints !== undefined) {
44113
44114
  // Cached value excludes resolutions to JS files - those could be
44114
44115
  // cached separately, but they're used rarely.
44115
- return packageJsonInfo.resolvedEntrypoints;
44116
+ return packageJsonInfo.contents.resolvedEntrypoints;
44116
44117
  }
44117
44118
  var entrypoints;
44118
44119
  var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript;
@@ -44121,13 +44122,13 @@ var ts;
44121
44122
  requireState.conditions = ["node", "require", "types"];
44122
44123
  requireState.requestContainingDirectory = packageJsonInfo.packageDirectory;
44123
44124
  var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
44124
- /*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
44125
+ /*onlyRecordFailures*/ false, requireState, packageJsonInfo.contents.packageJsonContent, packageJsonInfo.contents.versionPaths);
44125
44126
  entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
44126
- if (features & NodeResolutionFeatures.Exports && packageJsonInfo.packageJsonContent.exports) {
44127
+ if (features & NodeResolutionFeatures.Exports && packageJsonInfo.contents.packageJsonContent.exports) {
44127
44128
  for (var _i = 0, _a = [["node", "import", "types"], ["node", "require", "types"]]; _i < _a.length; _i++) {
44128
44129
  var conditions = _a[_i];
44129
44130
  var exportState = __assign(__assign({}, requireState), { failedLookupLocations: [], conditions: conditions });
44130
- var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.packageJsonContent.exports, exportState, extensions);
44131
+ var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.contents.packageJsonContent.exports, exportState, extensions);
44131
44132
  if (exportResolutions) {
44132
44133
  for (var _b = 0, exportResolutions_1 = exportResolutions; _b < exportResolutions_1.length; _b++) {
44133
44134
  var resolution = exportResolutions_1[_b];
@@ -44136,7 +44137,7 @@ var ts;
44136
44137
  }
44137
44138
  }
44138
44139
  }
44139
- return packageJsonInfo.resolvedEntrypoints = entrypoints || false;
44140
+ return packageJsonInfo.contents.resolvedEntrypoints = entrypoints || false;
44140
44141
  }
44141
44142
  ts.getEntrypointsFromPackageJsonInfo = getEntrypointsFromPackageJsonInfo;
44142
44143
  function loadEntrypointsFromExportMap(scope, exports, state, extensions) {
@@ -44240,7 +44241,9 @@ var ts;
44240
44241
  if (traceEnabled)
44241
44242
  trace(host, ts.Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
44242
44243
  state.affectingLocations.push(packageJsonPath);
44243
- return existing;
44244
+ return existing.packageDirectory === packageDirectory ?
44245
+ existing :
44246
+ { packageDirectory: packageDirectory, contents: existing.contents };
44244
44247
  }
44245
44248
  else {
44246
44249
  if (existing && traceEnabled)
@@ -44256,7 +44259,7 @@ var ts;
44256
44259
  trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
44257
44260
  }
44258
44261
  var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
44259
- var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
44262
+ var result = { packageDirectory: packageDirectory, contents: { packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined } };
44260
44263
  (_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
44261
44264
  state.affectingLocations.push(packageJsonPath);
44262
44265
  return result;
@@ -44381,17 +44384,16 @@ var ts;
44381
44384
  }
44382
44385
  function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
44383
44386
  var _a, _b;
44384
- var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
44385
- var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
44387
+ var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
44386
44388
  var scope = getPackageScopeForPath(directoryPath, state);
44387
- if (!scope || !scope.packageJsonContent.exports) {
44389
+ if (!scope || !scope.contents.packageJsonContent.exports) {
44388
44390
  return undefined;
44389
44391
  }
44390
- if (typeof scope.packageJsonContent.name !== "string") {
44392
+ if (typeof scope.contents.packageJsonContent.name !== "string") {
44391
44393
  return undefined;
44392
44394
  }
44393
44395
  var parts = ts.getPathComponents(moduleName); // unrooted paths should have `""` as their 0th entry
44394
- var nameParts = ts.getPathComponents(scope.packageJsonContent.name);
44396
+ var nameParts = ts.getPathComponents(scope.contents.packageJsonContent.name);
44395
44397
  if (!ts.every(nameParts, function (p, i) { return parts[i] === p; })) {
44396
44398
  return undefined;
44397
44399
  }
@@ -44399,30 +44401,30 @@ var ts;
44399
44401
  return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : ".".concat(ts.directorySeparator).concat(trailingParts.join(ts.directorySeparator)), state, cache, redirectedReference);
44400
44402
  }
44401
44403
  function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
44402
- if (!scope.packageJsonContent.exports) {
44404
+ if (!scope.contents.packageJsonContent.exports) {
44403
44405
  return undefined;
44404
44406
  }
44405
44407
  if (subpath === ".") {
44406
44408
  var mainExport = void 0;
44407
- if (typeof scope.packageJsonContent.exports === "string" || Array.isArray(scope.packageJsonContent.exports) || (typeof scope.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.packageJsonContent.exports))) {
44408
- mainExport = scope.packageJsonContent.exports;
44409
+ if (typeof scope.contents.packageJsonContent.exports === "string" || Array.isArray(scope.contents.packageJsonContent.exports) || (typeof scope.contents.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.contents.packageJsonContent.exports))) {
44410
+ mainExport = scope.contents.packageJsonContent.exports;
44409
44411
  }
44410
- else if (ts.hasProperty(scope.packageJsonContent.exports, ".")) {
44411
- mainExport = scope.packageJsonContent.exports["."];
44412
+ else if (ts.hasProperty(scope.contents.packageJsonContent.exports, ".")) {
44413
+ mainExport = scope.contents.packageJsonContent.exports["."];
44412
44414
  }
44413
44415
  if (mainExport) {
44414
44416
  var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false);
44415
44417
  return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false);
44416
44418
  }
44417
44419
  }
44418
- else if (allKeysStartWithDot(scope.packageJsonContent.exports)) {
44419
- if (typeof scope.packageJsonContent.exports !== "object") {
44420
+ else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) {
44421
+ if (typeof scope.contents.packageJsonContent.exports !== "object") {
44420
44422
  if (state.traceEnabled) {
44421
44423
  trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory);
44422
44424
  }
44423
44425
  return toSearchResult(/*value*/ undefined);
44424
44426
  }
44425
- var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.packageJsonContent.exports, scope, /*isImports*/ false);
44427
+ var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.contents.packageJsonContent.exports, scope, /*isImports*/ false);
44426
44428
  if (result) {
44427
44429
  return result;
44428
44430
  }
@@ -44440,8 +44442,7 @@ var ts;
44440
44442
  }
44441
44443
  return toSearchResult(/*value*/ undefined);
44442
44444
  }
44443
- var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
44444
- var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
44445
+ var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
44445
44446
  var scope = getPackageScopeForPath(directoryPath, state);
44446
44447
  if (!scope) {
44447
44448
  if (state.traceEnabled) {
@@ -44449,13 +44450,13 @@ var ts;
44449
44450
  }
44450
44451
  return toSearchResult(/*value*/ undefined);
44451
44452
  }
44452
- if (!scope.packageJsonContent.imports) {
44453
+ if (!scope.contents.packageJsonContent.imports) {
44453
44454
  if (state.traceEnabled) {
44454
44455
  trace(state.host, ts.Diagnostics.package_json_scope_0_has_no_imports_defined, scope.packageDirectory);
44455
44456
  }
44456
44457
  return toSearchResult(/*value*/ undefined);
44457
44458
  }
44458
- var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.packageJsonContent.imports, scope, /*isImports*/ true);
44459
+ var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.contents.packageJsonContent.imports, scope, /*isImports*/ true);
44459
44460
  if (result) {
44460
44461
  return result;
44461
44462
  }
@@ -44800,7 +44801,7 @@ var ts;
44800
44801
  if (fromFile) {
44801
44802
  return noPackageId(fromFile);
44802
44803
  }
44803
- var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
44804
+ var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.contents.packageJsonContent, packageInfo.contents.versionPaths);
44804
44805
  return withPackageId(packageInfo, fromDirectory);
44805
44806
  }
44806
44807
  }
@@ -44808,14 +44809,14 @@ var ts;
44808
44809
  var loader = function (extensions, candidate, onlyRecordFailures, state) {
44809
44810
  var _a;
44810
44811
  // package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them)
44811
- if (packageInfo && packageInfo.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
44812
+ if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
44812
44813
  return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
44813
44814
  }
44814
44815
  var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
44815
- loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
44816
+ loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths);
44816
44817
  if (!pathAndExtension && packageInfo
44817
44818
  // eslint-disable-next-line no-null/no-null
44818
- && (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null)
44819
+ && (packageInfo.contents.packageJsonContent.exports === undefined || packageInfo.contents.packageJsonContent.exports === null)
44819
44820
  && state.features & NodeResolutionFeatures.EsmMode) {
44820
44821
  // EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
44821
44822
  // a default `index.js` entrypoint if no `main` or `exports` are present
@@ -44827,12 +44828,12 @@ var ts;
44827
44828
  var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
44828
44829
  // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings.
44829
44830
  packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
44830
- if (packageInfo && packageInfo.versionPaths) {
44831
+ if (packageInfo && packageInfo.contents.versionPaths) {
44831
44832
  if (state.traceEnabled) {
44832
- trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.versionPaths.version, ts.version, rest);
44833
+ trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest);
44833
44834
  }
44834
44835
  var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host);
44835
- var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state);
44836
+ var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state);
44836
44837
  if (fromPaths) {
44837
44838
  return fromPaths.value;
44838
44839
  }
@@ -49133,6 +49134,7 @@ var ts;
49133
49134
  var wildcardType = createIntrinsicType(1 /* TypeFlags.Any */, "any");
49134
49135
  var errorType = createIntrinsicType(1 /* TypeFlags.Any */, "error");
49135
49136
  var unresolvedType = createIntrinsicType(1 /* TypeFlags.Any */, "unresolved");
49137
+ var nonInferrableAnyType = createIntrinsicType(1 /* TypeFlags.Any */, "any", 65536 /* ObjectFlags.ContainsWideningType */);
49136
49138
  var intrinsicMarkerType = createIntrinsicType(1 /* TypeFlags.Any */, "intrinsic");
49137
49139
  var unknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown");
49138
49140
  var nonNullUnknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown");
@@ -51734,7 +51736,7 @@ var ts;
51734
51736
  if (ext === ".ts" /* Extension.Ts */ || ext === ".js" /* Extension.Js */ || ext === ".tsx" /* Extension.Tsx */ || ext === ".jsx" /* Extension.Jsx */) {
51735
51737
  var scope = currentSourceFile.packageJsonScope;
51736
51738
  var targetExt = ext === ".ts" /* Extension.Ts */ ? ".mts" /* Extension.Mts */ : ext === ".js" /* Extension.Js */ ? ".mjs" /* Extension.Mjs */ : undefined;
51737
- if (scope && !scope.packageJsonContent.type) {
51739
+ if (scope && !scope.contents.packageJsonContent.type) {
51738
51740
  if (targetExt) {
51739
51741
  diagnosticDetails = ts.chainDiagnosticMessages(
51740
51742
  /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json"));
@@ -53962,22 +53964,15 @@ var ts;
53962
53964
  context.approximateLength += ts.symbolName(parameterSymbol).length + 3;
53963
53965
  return parameterNode;
53964
53966
  function cloneBindingName(node) {
53965
- return elideInitializerAndPropertyRenamingAndSetEmitFlags(node);
53966
- function elideInitializerAndPropertyRenamingAndSetEmitFlags(node) {
53967
+ return elideInitializerAndSetEmitFlags(node);
53968
+ function elideInitializerAndSetEmitFlags(node) {
53967
53969
  if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) {
53968
53970
  trackComputedName(node.expression, context.enclosingDeclaration, context);
53969
53971
  }
53970
- var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags);
53972
+ var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags);
53971
53973
  if (ts.isBindingElement(visited)) {
53972
- if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) {
53973
- visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken,
53974
- /* propertyName*/ undefined, visited.propertyName,
53975
- /*initializer*/ undefined);
53976
- }
53977
- else {
53978
- visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
53979
- /*initializer*/ undefined);
53980
- }
53974
+ visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
53975
+ /*initializer*/ undefined);
53981
53976
  }
53982
53977
  if (!ts.nodeIsSynthesized(visited)) {
53983
53978
  visited = ts.factory.cloneNode(visited);
@@ -56972,7 +56967,11 @@ var ts;
56972
56967
  if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
56973
56968
  reportImplicitAny(element, anyType);
56974
56969
  }
56975
- return anyType;
56970
+ // When we're including the pattern in the type (an indication we're obtaining a contextual type), we
56971
+ // use a non-inferrable any type. Inference will never directly infer this type, but it is possible
56972
+ // to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases,
56973
+ // widening of the binding pattern type substitutes a regular any for the non-inferrable any.
56974
+ return includePatternInType ? nonInferrableAnyType : anyType;
56976
56975
  }
56977
56976
  // Return the type implied by an object binding pattern
56978
56977
  function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
@@ -59073,6 +59072,12 @@ var ts;
59073
59072
  return mapType(type, getLowerBoundOfKeyType);
59074
59073
  }
59075
59074
  if (type.flags & 2097152 /* TypeFlags.Intersection */) {
59075
+ // Similarly to getTypeFromIntersectionTypeNode, we preserve the special string & {}, number & {},
59076
+ // and bigint & {} intersections that are used to prevent subtype reduction in union types.
59077
+ var types = type.types;
59078
+ if (types.length === 2 && !!(types[0].flags & (4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) && types[1] === emptyTypeLiteralType) {
59079
+ return type;
59080
+ }
59076
59081
  return getIntersectionType(ts.sameMap(type.types, getLowerBoundOfKeyType));
59077
59082
  }
59078
59083
  return type;
@@ -69260,7 +69265,10 @@ var ts;
69260
69265
  //
69261
69266
  // This flag is infectious; if we produce Box<never> (where never is silentNeverType), Box<never> is
69262
69267
  // also non-inferrable.
69263
- if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */) {
69268
+ //
69269
+ // As a special case, also ignore nonInferrableAnyType, which is a special form of the any type
69270
+ // used as a stand-in for binding elements when they are being inferred.
69271
+ if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */ || source === nonInferrableAnyType) {
69264
69272
  return;
69265
69273
  }
69266
69274
  if (!inference.isFixed) {
@@ -81426,7 +81434,7 @@ var ts;
81426
81434
  checkDecorators(node);
81427
81435
  }
81428
81436
  function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) {
81429
- if (index < typeParameters.length) {
81437
+ if (node.typeArguments && index < node.typeArguments.length) {
81430
81438
  return getTypeFromTypeNode(node.typeArguments[index]);
81431
81439
  }
81432
81440
  return getEffectiveTypeArguments(node, typeParameters)[index];
@@ -90205,7 +90213,7 @@ var ts;
90205
90213
  return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
90206
90214
  }
90207
90215
  var nodeArguments = node.arguments;
90208
- if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
90216
+ if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext && moduleKind !== ts.ModuleKind.Node16) {
90209
90217
  // We are allowed trailing comma after proposal-import-assertions.
90210
90218
  checkGrammarForDisallowedTrailingComma(nodeArguments);
90211
90219
  if (nodeArguments.length > 1) {
@@ -117852,7 +117860,7 @@ var ts;
117852
117860
  state.failedLookupLocations = packageJsonLocations;
117853
117861
  state.affectingLocations = packageJsonLocations;
117854
117862
  var packageJsonScope = ts.getPackageScopeForPath(fileName, state);
117855
- var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
117863
+ var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
117856
117864
  return { impliedNodeFormat: impliedNodeFormat, packageJsonLocations: packageJsonLocations, packageJsonScope: packageJsonScope };
117857
117865
  }
117858
117866
  }
@@ -119583,7 +119591,7 @@ var ts;
119583
119591
  // It's a _little odd_ that we can't set `impliedNodeFormat` until the program step - but it's the first and only time we have a resolution cache
119584
119592
  // and a freshly made source file node on hand at the same time, and we need both to set the field. Persisting the resolution cache all the way
119585
119593
  // to the check and emit steps would be bad - so we much prefer detecting and storing the format information on the source file node upfront.
119586
- var result = getImpliedNodeFormatForFileWorker(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
119594
+ var result = getImpliedNodeFormatForFileWorker(ts.getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
119587
119595
  var languageVersion = ts.getEmitScriptTarget(options);
119588
119596
  var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options);
119589
119597
  return typeof result === "object" ? __assign(__assign({}, result), { languageVersion: languageVersion, setExternalModuleIndicator: setExternalModuleIndicator }) :
@@ -124244,7 +124252,7 @@ var ts;
124244
124252
  var maybeBlockedByTypesVersions = false;
124245
124253
  var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
124246
124254
  if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
124247
- var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
124255
+ var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
124248
124256
  var importMode = overrideMode || importingSourceFile.impliedNodeFormat;
124249
124257
  if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
124250
124258
  var conditions = ["node", importMode === ts.ModuleKind.ESNext ? "import" : "require", "types"];
@@ -124606,7 +124614,7 @@ var ts;
124606
124614
  case ts.ModuleKind.CommonJS:
124607
124615
  if (file.packageJsonScope) {
124608
124616
  (result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
124609
- /*details*/ undefined, file.packageJsonScope.packageJsonContent.type ?
124617
+ /*details*/ undefined, file.packageJsonScope.contents.packageJsonContent.type ?
124610
124618
  ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module :
124611
124619
  ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor)));
124612
124620
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.8.3",
5
+ "version": "4.8.4",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [