typescript 5.0.0-dev.20230110 → 5.0.0-dev.20230112

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.
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.0";
57
- var version = `${versionMajorMinor}.0-dev.20230110`;
57
+ var version = `${versionMajorMinor}.0-dev.20230112`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -6207,6 +6207,7 @@ var Diagnostics = {
6207
6207
  Default_export_of_the_module_has_or_is_using_private_name_0: diag(4082, 1 /* Error */, "Default_export_of_the_module_has_or_is_using_private_name_0_4082", "Default export of the module has or is using private name '{0}'."),
6208
6208
  Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: diag(4083, 1 /* Error */, "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", "Type parameter '{0}' of exported type alias has or is using private name '{1}'."),
6209
6209
  Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2: diag(4084, 1 /* Error */, "Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2_4084", "Exported type alias '{0}' has or is using private name '{1}' from module {2}."),
6210
+ Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1: diag(4085, 1 /* Error */, "Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1_4085", "Extends clause for inferred type '{0}' has or is using private name '{1}'."),
6210
6211
  Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: diag(4090, 1 /* Error */, "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict."),
6211
6212
  Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."),
6212
6213
  Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."),
@@ -7790,7 +7791,8 @@ function isIdentifierStart(ch, languageVersion) {
7790
7791
  return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
7791
7792
  }
7792
7793
  function isIdentifierPart(ch, languageVersion, identifierVariant) {
7793
- return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || (identifierVariant === 1 /* JSX */ ? ch === 45 /* minus */ || ch === 58 /* colon */ : false) || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);
7794
+ return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || // "-" and ":" are valid in JSX Identifiers
7795
+ (identifierVariant === 1 /* JSX */ ? ch === 45 /* minus */ || ch === 58 /* colon */ : false) || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);
7794
7796
  }
7795
7797
  function isIdentifierText(name, languageVersion, identifierVariant) {
7796
7798
  let ch = codePointAt(name, 0);
@@ -27759,7 +27761,8 @@ function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue,
27759
27761
  if (returnValue) {
27760
27762
  result[keyText] = value;
27761
27763
  }
27762
- if (jsonConversionNotifier && (parentOption || isRootOptionMap(knownOptions))) {
27764
+ if (jsonConversionNotifier && // Current callbacks are only on known parent option or if we are setting values in the root
27765
+ (parentOption || isRootOptionMap(knownOptions))) {
27763
27766
  const isValidOptionValue = isCompilerOptionsValue(option, value);
27764
27767
  if (parentOption) {
27765
27768
  if (isValidOptionValue) {
@@ -28484,7 +28487,8 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
28484
28487
  conditions,
28485
28488
  requestContainingDirectory: containingDirectory,
28486
28489
  reportDiagnostic: (diag2) => void diagnostics.push(diag2),
28487
- isConfigLookup
28490
+ isConfigLookup,
28491
+ candidateIsFromPackageJsonField: false
28488
28492
  };
28489
28493
  if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
28490
28494
  trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
@@ -28708,7 +28712,7 @@ function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecor
28708
28712
  }
28709
28713
  function tryExtension(ext, resolvedUsingTsExtension) {
28710
28714
  const path2 = tryFile(candidate + ext, onlyRecordFailures, state);
28711
- return path2 === void 0 ? void 0 : { path: path2, ext, resolvedUsingTsExtension };
28715
+ return path2 === void 0 ? void 0 : { path: path2, ext, resolvedUsingTsExtension: !state.candidateIsFromPackageJsonField && resolvedUsingTsExtension };
28712
28716
  }
28713
28717
  }
28714
28718
  function tryFile(fileName, onlyRecordFailures, state) {
@@ -28827,6 +28831,8 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
28827
28831
  }
28828
28832
  const expandedExtensions = extensions2 === 4 /* Declaration */ ? 1 /* TypeScript */ | 4 /* Declaration */ : extensions2;
28829
28833
  const features = state2.features;
28834
+ const candidateIsFromPackageJsonField = state2.candidateIsFromPackageJsonField;
28835
+ state2.candidateIsFromPackageJsonField = true;
28830
28836
  if ((jsonContent == null ? void 0 : jsonContent.type) !== "module") {
28831
28837
  state2.features &= ~32 /* EsmMode */;
28832
28838
  }
@@ -28839,6 +28845,7 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
28839
28845
  false
28840
28846
  );
28841
28847
  state2.features = features;
28848
+ state2.candidateIsFromPackageJsonField = candidateIsFromPackageJsonField;
28842
28849
  return result;
28843
28850
  };
28844
28851
  const onlyRecordFailuresForPackageFile = packageFile ? !directoryProbablyExists(getDirectoryPath(packageFile), state.host) : void 0;
@@ -28912,7 +28919,10 @@ function loadModuleFromSelfNameReference(extensions, moduleName, directory, stat
28912
28919
  return void 0;
28913
28920
  }
28914
28921
  const trailingParts = parts.slice(nameParts.length);
28915
- return loadModuleFromExports(scope, extensions, !length(trailingParts) ? "." : `.${directorySeparator}${trailingParts.join(directorySeparator)}`, state, cache, redirectedReference);
28922
+ const subpath = !length(trailingParts) ? "." : `.${directorySeparator}${trailingParts.join(directorySeparator)}`;
28923
+ const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
28924
+ const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
28925
+ return loadModuleFromExports(scope, priorityExtensions, subpath, state, cache, redirectedReference) || loadModuleFromExports(scope, secondaryExtensions, subpath, state, cache, redirectedReference);
28916
28926
  }
28917
28927
  function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
28918
28928
  if (!scope.contents.packageJsonContent.exports) {
@@ -29414,25 +29424,26 @@ function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, dir
29414
29424
  }
29415
29425
  }
29416
29426
  function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
29417
- var _a2;
29427
+ var _a2, _b, _c;
29418
29428
  const candidate = normalizePath(combinePaths(nodeModulesDirectory, moduleName));
29429
+ const { packageName, rest } = parsePackageName(moduleName);
29430
+ const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
29431
+ let rootPackageInfo;
29419
29432
  let packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
29420
- if (!(state.features & 8 /* Exports */)) {
29421
- if (packageInfo) {
29422
- const fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
29423
- if (fromFile) {
29424
- return noPackageId(fromFile);
29425
- }
29426
- const fromDirectory = loadNodeModuleFromDirectoryWorker(
29427
- extensions,
29428
- candidate,
29429
- !nodeModulesDirectoryExists,
29430
- state,
29431
- packageInfo.contents.packageJsonContent,
29432
- getVersionPathsOfPackageJsonInfo(packageInfo, state)
29433
- );
29434
- return withPackageId(packageInfo, fromDirectory);
29433
+ if (rest !== "" && packageInfo && (!(state.features & 8 /* Exports */) || !hasProperty((_b = (_a2 = rootPackageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state)) == null ? void 0 : _a2.contents.packageJsonContent) != null ? _b : emptyArray, "exports"))) {
29434
+ const fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
29435
+ if (fromFile) {
29436
+ return noPackageId(fromFile);
29435
29437
  }
29438
+ const fromDirectory = loadNodeModuleFromDirectoryWorker(
29439
+ extensions,
29440
+ candidate,
29441
+ !nodeModulesDirectoryExists,
29442
+ state,
29443
+ packageInfo.contents.packageJsonContent,
29444
+ getVersionPathsOfPackageJsonInfo(packageInfo, state)
29445
+ );
29446
+ return withPackageId(packageInfo, fromDirectory);
29436
29447
  }
29437
29448
  const loader = (extensions2, candidate2, onlyRecordFailures, state2) => {
29438
29449
  let pathAndExtension = loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker(
@@ -29448,13 +29459,11 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
29448
29459
  }
29449
29460
  return withPackageId(packageInfo, pathAndExtension);
29450
29461
  };
29451
- const { packageName, rest } = parsePackageName(moduleName);
29452
- const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
29453
29462
  if (rest !== "") {
29454
- packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
29463
+ packageInfo = rootPackageInfo != null ? rootPackageInfo : getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
29455
29464
  }
29456
29465
  if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
29457
- return (_a2 = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _a2.value;
29466
+ return (_c = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _c.value;
29458
29467
  }
29459
29468
  const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
29460
29469
  if (versionPaths) {
@@ -29558,7 +29567,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
29558
29567
  conditions: [],
29559
29568
  requestContainingDirectory: containingDirectory,
29560
29569
  reportDiagnostic: (diag2) => void diagnostics.push(diag2),
29561
- isConfigLookup: false
29570
+ isConfigLookup: false,
29571
+ candidateIsFromPackageJsonField: false
29562
29572
  };
29563
29573
  const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
29564
29574
  return createResolvedModuleWithFailedLookupLocations(
@@ -32344,8 +32354,12 @@ function createBinder() {
32344
32354
  return false;
32345
32355
  }
32346
32356
  if (currentFlow === unreachableFlow) {
32347
- const reportError = isStatementButNotDeclaration(node) && node.kind !== 239 /* EmptyStatement */ || // report error on class declarations
32348
- node.kind === 260 /* ClassDeclaration */ || node.kind === 264 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node);
32357
+ const reportError = (
32358
+ // report error on all statements except empty ones
32359
+ isStatementButNotDeclaration(node) && node.kind !== 239 /* EmptyStatement */ || // report error on class declarations
32360
+ node.kind === 260 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set
32361
+ node.kind === 264 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)
32362
+ );
32349
32363
  if (reportError) {
32350
32364
  currentFlow = reportedUnreachableFlow;
32351
32365
  if (!options.allowUnreachableCode) {
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": "5.0.0-dev.20230110",
5
+ "version": "5.0.0-dev.20230112",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [