typescript 5.1.0-dev.20230227 → 5.1.0-dev.20230302

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.1";
57
- var version = `${versionMajorMinor}.0-dev.20230227`;
57
+ var version = `${versionMajorMinor}.0-dev.20230302`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -6577,6 +6577,7 @@ var Diagnostics = {
6577
6577
  File_name_0_has_a_1_extension_looking_up_2_instead: diag(6262, 3 /* Message */, "File_name_0_has_a_1_extension_looking_up_2_instead_6262", "File name '{0}' has a '{1}' extension - looking up '{2}' instead."),
6578
6578
  Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set: diag(6263, 1 /* Error */, "Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set_6263", "Module '{0}' was resolved to '{1}', but '--allowArbitraryExtensions' is not set."),
6579
6579
  Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present: diag(6264, 3 /* Message */, "Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present_6264", "Enable importing files with any extension, provided a declaration file is present."),
6580
+ Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder: diag(6265, 3 /* Message */, "Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_no_6265", "Resolving type reference directive for program that specifies custom typeRoots, skipping lookup in 'node_modules' folder."),
6580
6581
  Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, 3 /* Message */, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
6581
6582
  Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, 3 /* Message */, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
6582
6583
  Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, 3 /* Message */, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
@@ -6972,6 +6973,8 @@ var Diagnostics = {
6972
6973
  This_may_be_converted_to_an_async_function: diag(80006, 2 /* Suggestion */, "This_may_be_converted_to_an_async_function_80006", "This may be converted to an async function."),
6973
6974
  await_has_no_effect_on_the_type_of_this_expression: diag(80007, 2 /* Suggestion */, "await_has_no_effect_on_the_type_of_this_expression_80007", "'await' has no effect on the type of this expression."),
6974
6975
  Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers: diag(80008, 2 /* Suggestion */, "Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accur_80008", "Numeric literals with absolute values equal to 2^53 or greater are too large to be represented accurately as integers."),
6976
+ JSDoc_typedef_may_be_converted_to_TypeScript_type: diag(80009, 2 /* Suggestion */, "JSDoc_typedef_may_be_converted_to_TypeScript_type_80009", "JSDoc typedef may be converted to TypeScript type."),
6977
+ JSDoc_typedefs_may_be_converted_to_TypeScript_types: diag(80010, 2 /* Suggestion */, "JSDoc_typedefs_may_be_converted_to_TypeScript_types_80010", "JSDoc typedefs may be converted to TypeScript types."),
6975
6978
  Add_missing_super_call: diag(90001, 3 /* Message */, "Add_missing_super_call_90001", "Add missing 'super()' call"),
6976
6979
  Make_super_call_the_first_statement_in_the_constructor: diag(90002, 3 /* Message */, "Make_super_call_the_first_statement_in_the_constructor_90002", "Make 'super()' call the first statement in the constructor"),
6977
6980
  Change_extends_to_implements: diag(90003, 3 /* Message */, "Change_extends_to_implements_90003", "Change 'extends' to 'implements'"),
@@ -7186,6 +7189,8 @@ var Diagnostics = {
7186
7189
  Rename_param_tag_name_0_to_1: diag(95173, 3 /* Message */, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"),
7187
7190
  Use_0: diag(95174, 3 /* Message */, "Use_0_95174", "Use `{0}`."),
7188
7191
  Use_Number_isNaN_in_all_conditions: diag(95175, 3 /* Message */, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
7192
+ Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
7193
+ Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
7189
7194
  No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
7190
7195
  Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
7191
7196
  JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
@@ -28534,6 +28539,9 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
28534
28539
  }
28535
28540
  resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
28536
28541
  }
28542
+ if (extensions2 & 4 /* Declaration */) {
28543
+ resolved2 != null ? resolved2 : resolved2 = resolveFromTypeRoot(moduleName, state2);
28544
+ }
28537
28545
  return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
28538
28546
  } else {
28539
28547
  const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
@@ -28714,6 +28722,7 @@ function tryFile(fileName, onlyRecordFailures, state) {
28714
28722
  return forEach(state.compilerOptions.moduleSuffixes, (suffix) => tryFileLookup(fileNameNoExtension + suffix + ext, onlyRecordFailures, state));
28715
28723
  }
28716
28724
  function tryFileLookup(fileName, onlyRecordFailures, state) {
28725
+ var _a2;
28717
28726
  if (!onlyRecordFailures) {
28718
28727
  if (state.host.fileExists(fileName)) {
28719
28728
  if (state.traceEnabled) {
@@ -28726,7 +28735,7 @@ function tryFileLookup(fileName, onlyRecordFailures, state) {
28726
28735
  }
28727
28736
  }
28728
28737
  }
28729
- state.failedLookupLocations.push(fileName);
28738
+ (_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(fileName);
28730
28739
  return void 0;
28731
28740
  }
28732
28741
  function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
@@ -28759,24 +28768,24 @@ function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
28759
28768
  return packageJsonInfo.contents.versionPaths || void 0;
28760
28769
  }
28761
28770
  function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
28762
- var _a2, _b, _c;
28771
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
28763
28772
  const { host, traceEnabled } = state;
28764
28773
  const packageJsonPath = combinePaths(packageDirectory, "package.json");
28765
28774
  if (onlyRecordFailures) {
28766
- state.failedLookupLocations.push(packageJsonPath);
28775
+ (_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(packageJsonPath);
28767
28776
  return void 0;
28768
28777
  }
28769
- const existing = (_a2 = state.packageJsonInfoCache) == null ? void 0 : _a2.getPackageJsonInfo(packageJsonPath);
28778
+ const existing = (_b = state.packageJsonInfoCache) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
28770
28779
  if (existing !== void 0) {
28771
28780
  if (typeof existing !== "boolean") {
28772
28781
  if (traceEnabled)
28773
28782
  trace(host, Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
28774
- state.affectingLocations.push(packageJsonPath);
28783
+ (_c = state.affectingLocations) == null ? void 0 : _c.push(packageJsonPath);
28775
28784
  return existing.packageDirectory === packageDirectory ? existing : { packageDirectory, contents: existing.contents };
28776
28785
  } else {
28777
28786
  if (existing && traceEnabled)
28778
28787
  trace(host, Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups, packageJsonPath);
28779
- state.failedLookupLocations.push(packageJsonPath);
28788
+ (_d = state.failedLookupLocations) == null ? void 0 : _d.push(packageJsonPath);
28780
28789
  return void 0;
28781
28790
  }
28782
28791
  }
@@ -28787,15 +28796,15 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
28787
28796
  trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
28788
28797
  }
28789
28798
  const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
28790
- (_b = state.packageJsonInfoCache) == null ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
28791
- state.affectingLocations.push(packageJsonPath);
28799
+ (_e = state.packageJsonInfoCache) == null ? void 0 : _e.setPackageJsonInfo(packageJsonPath, result);
28800
+ (_f = state.affectingLocations) == null ? void 0 : _f.push(packageJsonPath);
28792
28801
  return result;
28793
28802
  } else {
28794
28803
  if (directoryExists && traceEnabled) {
28795
28804
  trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
28796
28805
  }
28797
- (_c = state.packageJsonInfoCache) == null ? void 0 : _c.setPackageJsonInfo(packageJsonPath, directoryExists);
28798
- state.failedLookupLocations.push(packageJsonPath);
28806
+ (_g = state.packageJsonInfoCache) == null ? void 0 : _g.setPackageJsonInfo(packageJsonPath, directoryExists);
28807
+ (_h = state.failedLookupLocations) == null ? void 0 : _h.push(packageJsonPath);
28799
28808
  }
28800
28809
  }
28801
28810
  function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
@@ -29603,11 +29612,13 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
29603
29612
  state
29604
29613
  ));
29605
29614
  });
29606
- if (resolved2) {
29615
+ if (resolved2)
29607
29616
  return resolved2;
29608
- }
29609
29617
  if (extensions & (1 /* TypeScript */ | 4 /* Declaration */)) {
29610
- return loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
29618
+ let resolved3 = loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
29619
+ if (extensions & 4 /* Declaration */)
29620
+ resolved3 != null ? resolved3 : resolved3 = resolveFromTypeRoot(moduleName, state);
29621
+ return resolved3;
29611
29622
  }
29612
29623
  } else {
29613
29624
  const candidate = normalizePath(combinePaths(containingDirectory, moduleName));
@@ -29621,6 +29632,31 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
29621
29632
  }
29622
29633
  }
29623
29634
  }
29635
+ function resolveFromTypeRoot(moduleName, state) {
29636
+ if (!state.compilerOptions.typeRoots)
29637
+ return;
29638
+ for (const typeRoot of state.compilerOptions.typeRoots) {
29639
+ const candidate = combinePaths(typeRoot, moduleName);
29640
+ const directoryExists = directoryProbablyExists(typeRoot, state.host);
29641
+ if (!directoryExists && state.traceEnabled) {
29642
+ trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
29643
+ }
29644
+ const resolvedFromFile = loadModuleFromFile(4 /* Declaration */, candidate, !directoryExists, state);
29645
+ if (resolvedFromFile) {
29646
+ const packageDirectory = parseNodeModuleFromPath(resolvedFromFile.path);
29647
+ const packageInfo = packageDirectory ? getPackageJsonInfo(
29648
+ packageDirectory,
29649
+ /*onlyRecordFailures*/
29650
+ false,
29651
+ state
29652
+ ) : void 0;
29653
+ return toSearchResult(withPackageId(packageInfo, resolvedFromFile));
29654
+ }
29655
+ const resolved = loadNodeModuleFromDirectory(4 /* Declaration */, candidate, !directoryExists, state);
29656
+ if (resolved)
29657
+ return toSearchResult(resolved);
29658
+ }
29659
+ }
29624
29660
  function toSearchResult(value) {
29625
29661
  return value !== void 0 ? { value } : void 0;
29626
29662
  }
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.1.0-dev.20230227",
5
+ "version": "5.1.0-dev.20230302",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -41,21 +41,21 @@
41
41
  "devDependencies": {
42
42
  "@esfx/canceltoken": "^1.0.0",
43
43
  "@octokit/rest": "latest",
44
- "@types/chai": "latest",
44
+ "@types/chai": "^4.3.4",
45
45
  "@types/fs-extra": "^9.0.13",
46
- "@types/glob": "latest",
47
- "@types/microsoft__typescript-etw": "latest",
48
- "@types/minimist": "latest",
49
- "@types/mocha": "latest",
50
- "@types/ms": "latest",
46
+ "@types/glob": "^8.1.0",
47
+ "@types/microsoft__typescript-etw": "^0.1.1",
48
+ "@types/minimist": "^1.2.2",
49
+ "@types/mocha": "^10.0.1",
50
+ "@types/ms": "^0.7.31",
51
51
  "@types/node": "latest",
52
- "@types/source-map-support": "latest",
52
+ "@types/source-map-support": "^0.5.6",
53
53
  "@types/which": "^2.0.1",
54
54
  "@typescript-eslint/eslint-plugin": "^5.33.1",
55
55
  "@typescript-eslint/parser": "^5.33.1",
56
56
  "@typescript-eslint/utils": "^5.33.1",
57
57
  "azure-devops-node-api": "^11.2.0",
58
- "chai": "latest",
58
+ "chai": "^4.3.7",
59
59
  "chalk": "^4.1.2",
60
60
  "chokidar": "^3.5.3",
61
61
  "del": "^6.1.1",
@@ -69,15 +69,15 @@
69
69
  "eslint-plugin-simple-import-sort": "^10.0.0",
70
70
  "fast-xml-parser": "^4.0.11",
71
71
  "fs-extra": "^9.1.0",
72
- "glob": "latest",
72
+ "glob": "^8.1.0",
73
73
  "hereby": "^1.6.4",
74
74
  "jsonc-parser": "^3.2.0",
75
- "minimist": "latest",
76
- "mocha": "latest",
77
- "mocha-fivemat-progress-reporter": "latest",
75
+ "minimist": "^1.2.8",
76
+ "mocha": "^10.2.0",
77
+ "mocha-fivemat-progress-reporter": "^0.1.0",
78
78
  "ms": "^2.1.3",
79
79
  "node-fetch": "^3.2.10",
80
- "source-map-support": "latest",
80
+ "source-map-support": "^0.5.21",
81
81
  "typescript": "5.0.0-dev.20230112",
82
82
  "which": "^2.0.2"
83
83
  },