typescript 5.2.0-dev.20230606 → 5.2.0-dev.20230608

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
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.2";
21
- var version = `${versionMajorMinor}.0-dev.20230606`;
21
+ var version = `${versionMajorMinor}.0-dev.20230608`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -1600,6 +1600,15 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
1600
1600
  );
1601
1601
  }
1602
1602
  Debug2.formatSnippetKind = formatSnippetKind;
1603
+ function formatScriptKind(kind) {
1604
+ return formatEnum(
1605
+ kind,
1606
+ ScriptKind,
1607
+ /*isFlags*/
1608
+ false
1609
+ );
1610
+ }
1611
+ Debug2.formatScriptKind = formatScriptKind;
1603
1612
  function formatNodeFlags(flags) {
1604
1613
  return formatEnum(
1605
1614
  flags,
@@ -3787,6 +3796,17 @@ var ModuleKind = /* @__PURE__ */ ((ModuleKind2) => {
3787
3796
  ModuleKind2[ModuleKind2["NodeNext"] = 199] = "NodeNext";
3788
3797
  return ModuleKind2;
3789
3798
  })(ModuleKind || {});
3799
+ var ScriptKind = /* @__PURE__ */ ((ScriptKind3) => {
3800
+ ScriptKind3[ScriptKind3["Unknown"] = 0] = "Unknown";
3801
+ ScriptKind3[ScriptKind3["JS"] = 1] = "JS";
3802
+ ScriptKind3[ScriptKind3["JSX"] = 2] = "JSX";
3803
+ ScriptKind3[ScriptKind3["TS"] = 3] = "TS";
3804
+ ScriptKind3[ScriptKind3["TSX"] = 4] = "TSX";
3805
+ ScriptKind3[ScriptKind3["External"] = 5] = "External";
3806
+ ScriptKind3[ScriptKind3["JSON"] = 6] = "JSON";
3807
+ ScriptKind3[ScriptKind3["Deferred"] = 7] = "Deferred";
3808
+ return ScriptKind3;
3809
+ })(ScriptKind || {});
3790
3810
  var TransformFlags = /* @__PURE__ */ ((TransformFlags3) => {
3791
3811
  TransformFlags3[TransformFlags3["None"] = 0] = "None";
3792
3812
  TransformFlags3[TransformFlags3["ContainsTypeScript"] = 1] = "ContainsTypeScript";
@@ -7708,6 +7728,7 @@ var Diagnostics = {
7708
7728
  Use_import_type: diag(95180, 3 /* Message */, "Use_import_type_95180", "Use 'import type'"),
7709
7729
  Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
7710
7730
  Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"),
7731
+ Cannot_move_statements_to_the_selected_file: diag(95183, 3 /* Message */, "Cannot_move_statements_to_the_selected_file_95183", "Cannot move statements to the selected file"),
7711
7732
  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."),
7712
7733
  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'."),
7713
7734
  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?"),
@@ -36913,7 +36934,7 @@ function compilerOptionValueToString(value) {
36913
36934
  return str + "}";
36914
36935
  }
36915
36936
  function getKeyForCompilerOptions(options, affectingOptionDeclarations) {
36916
- return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") + (options.pathsBasePath ? `|${options.pathsBasePath}` : void 0);
36937
+ return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") + `|${options.pathsBasePath}`;
36917
36938
  }
36918
36939
  function createCacheWithRedirects(ownOptions) {
36919
36940
  const redirectsMap = /* @__PURE__ */ new Map();
@@ -46475,7 +46496,7 @@ function createTypeChecker(host) {
46475
46496
  function createIntrinsicType(kind, intrinsicName, objectFlags = 0 /* None */) {
46476
46497
  const type = createType(kind);
46477
46498
  type.intrinsicName = intrinsicName;
46478
- type.objectFlags = objectFlags;
46499
+ type.objectFlags = objectFlags | 524288 /* CouldContainTypeVariablesComputed */ | 2097152 /* IsGenericTypeComputed */ | 33554432 /* IsUnknownLikeUnionComputed */ | 16777216 /* IsNeverIntersectionComputed */;
46479
46500
  return type;
46480
46501
  }
46481
46502
  function createObjectType(objectFlags, symbol) {
@@ -58096,13 +58117,18 @@ function createTypeChecker(host) {
58096
58117
  if (!result) {
58097
58118
  const newMapper = createTypeMapper(typeParameters, typeArguments);
58098
58119
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
58099
- if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58120
+ target.instantiations.set(id, result);
58121
+ const resultObjectFlags = getObjectFlags(result);
58122
+ if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58100
58123
  const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
58101
- if (!(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58102
- result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
58124
+ if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
58125
+ if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
58126
+ result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
58127
+ } else {
58128
+ result.objectFlags |= !resultCouldContainTypeVariables ? 524288 /* CouldContainTypeVariablesComputed */ : 0;
58129
+ }
58103
58130
  }
58104
58131
  }
58105
- target.instantiations.set(id, result);
58106
58132
  }
58107
58133
  return result;
58108
58134
  }
@@ -114487,13 +114513,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
114487
114513
  sourceFileOptions,
114488
114514
  /*onError*/
114489
114515
  void 0,
114490
- shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat
114516
+ shouldCreateNewSourceFile
114491
114517
  ) : host.getSourceFile(
114492
114518
  oldSourceFile.fileName,
114493
114519
  sourceFileOptions,
114494
114520
  /*onError*/
114495
114521
  void 0,
114496
- shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat
114522
+ shouldCreateNewSourceFile
114497
114523
  );
114498
114524
  if (!newSourceFile) {
114499
114525
  return 0 /* Not */;
@@ -115449,7 +115475,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115449
115475
  return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2 } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2 };
115450
115476
  }
115451
115477
  function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
115452
- var _a2, _b2;
115478
+ var _a2;
115453
115479
  const path = toPath3(fileName);
115454
115480
  if (useSourceOfProjectReferenceRedirect) {
115455
115481
  let source = getSourceOfProjectReferenceRedirect(path);
@@ -115528,7 +115554,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115528
115554
  Diagnostics.Cannot_read_file_0_Colon_1,
115529
115555
  [fileName, hostErrorMessage]
115530
115556
  ),
115531
- shouldCreateNewSourceFile || ((_a2 = oldProgram == null ? void 0 : oldProgram.getSourceFileByPath(toPath3(fileName))) == null ? void 0 : _a2.impliedNodeFormat) !== sourceFileOptions.impliedNodeFormat
115557
+ shouldCreateNewSourceFile
115532
115558
  );
115533
115559
  if (packageId) {
115534
115560
  const packageIdKey = packageIdToString(packageId);
@@ -115553,7 +115579,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115553
115579
  file.path = path;
115554
115580
  file.resolvedPath = toPath3(fileName);
115555
115581
  file.originalFileName = originalFileName;
115556
- file.packageJsonLocations = ((_b2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _b2.length) ? sourceFileOptions.packageJsonLocations : void 0;
115582
+ file.packageJsonLocations = ((_a2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _a2.length) ? sourceFileOptions.packageJsonLocations : void 0;
115557
115583
  file.packageJsonScope = sourceFileOptions.packageJsonScope;
115558
115584
  addFileIncludeReason(file, reason);
115559
115585
  if (host.useCaseSensitiveFileNames()) {
@@ -120623,7 +120649,8 @@ function createWatchProgram(host) {
120623
120649
  if (isFileMissingOnHost(hostSourceFile)) {
120624
120650
  return void 0;
120625
120651
  }
120626
- if (hostSourceFile === void 0 || shouldCreateNewSourceFile || isFilePresenceUnknownOnHost(hostSourceFile)) {
120652
+ const impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : void 0;
120653
+ if (hostSourceFile === void 0 || shouldCreateNewSourceFile || isFilePresenceUnknownOnHost(hostSourceFile) || hostSourceFile.sourceFile.impliedNodeFormat !== impliedNodeFormat) {
120627
120654
  const sourceFile = getNewSourceFile(fileName, languageVersionOrOptions, onError);
120628
120655
  if (hostSourceFile) {
120629
120656
  if (sourceFile) {