typescript 5.2.0-dev.20230601 → 5.2.0-dev.20230603

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.20230601`;
21
+ var version = `${versionMajorMinor}.0-dev.20230603`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -5986,8 +5986,6 @@ var Diagnostics = {
5986
5986
  Class_constructor_may_not_be_a_generator: diag(1368, 1 /* Error */, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."),
5987
5987
  Did_you_mean_0: diag(1369, 3 /* Message */, "Did_you_mean_0_1369", "Did you mean '{0}'?"),
5988
5988
  This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, 1 /* Error */, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."),
5989
- Convert_to_type_only_import: diag(1373, 3 /* Message */, "Convert_to_type_only_import_1373", "Convert to type-only import"),
5990
- Convert_all_imports_not_used_as_a_value_to_type_only_imports: diag(1374, 3 /* Message */, "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374", "Convert all imports not used as a value to type-only imports"),
5991
5989
  await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, 1 /* Error */, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
5992
5990
  _0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
5993
5991
  _0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
@@ -7193,6 +7191,8 @@ var Diagnostics = {
7193
7191
  Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."),
7194
7192
  Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."),
7195
7193
  Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
7194
+ Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0: diag(6417, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0_6417", "Searching all ancestor node_modules directories for preferred extensions: {0}."),
7195
+ Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0: diag(6418, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418", "Searching all ancestor node_modules directories for fallback extensions: {0}."),
7196
7196
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* 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}'"),
7197
7197
  The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
7198
7198
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -7705,6 +7705,9 @@ var Diagnostics = {
7705
7705
  Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
7706
7706
  Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
7707
7707
  Cannot_move_to_file_selected_file_is_invalid: diag(95179, 3 /* Message */, "Cannot_move_to_file_selected_file_is_invalid_95179", "Cannot move to file, selected file is invalid"),
7708
+ Use_import_type: diag(95180, 3 /* Message */, "Use_import_type_95180", "Use 'import type'"),
7709
+ Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
7710
+ Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"),
7708
7711
  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."),
7709
7712
  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'."),
7710
7713
  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?"),
@@ -38483,11 +38486,13 @@ function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName,
38483
38486
  const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
38484
38487
  const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
38485
38488
  if (priorityExtensions) {
38489
+ traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0, formatExtensions(priorityExtensions));
38486
38490
  const result = lookup(priorityExtensions);
38487
38491
  if (result)
38488
38492
  return result;
38489
38493
  }
38490
38494
  if (secondaryExtensions && !typesScopeOnly) {
38495
+ traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0, formatExtensions(secondaryExtensions));
38491
38496
  return lookup(secondaryExtensions);
38492
38497
  }
38493
38498
  function lookup(extensions2) {
@@ -64714,6 +64719,8 @@ function createTypeChecker(host) {
64714
64719
  }
64715
64720
  function isConstantReference(node) {
64716
64721
  switch (node.kind) {
64722
+ case 110 /* ThisKeyword */:
64723
+ return true;
64717
64724
  case 80 /* Identifier */:
64718
64725
  if (!isThisInTypeQuery(node)) {
64719
64726
  const symbol = getResolvedSymbol(node);
@@ -95399,7 +95406,7 @@ function transformJsx(context) {
95399
95406
  continue;
95400
95407
  }
95401
95408
  finishObjectLiteralIfNeeded();
95402
- expressions.push(attr.expression);
95409
+ expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression)));
95403
95410
  continue;
95404
95411
  }
95405
95412
  properties.push(transformJsxAttributeToObjectLiteralElement(attr));
package/lib/tsserver.js CHANGED
@@ -2304,7 +2304,7 @@ module.exports = __toCommonJS(server_exports);
2304
2304
 
2305
2305
  // src/compiler/corePublic.ts
2306
2306
  var versionMajorMinor = "5.2";
2307
- var version = `${versionMajorMinor}.0-dev.20230601`;
2307
+ var version = `${versionMajorMinor}.0-dev.20230603`;
2308
2308
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2309
2309
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2310
2310
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -9494,8 +9494,6 @@ var Diagnostics = {
9494
9494
  Class_constructor_may_not_be_a_generator: diag(1368, 1 /* Error */, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."),
9495
9495
  Did_you_mean_0: diag(1369, 3 /* Message */, "Did_you_mean_0_1369", "Did you mean '{0}'?"),
9496
9496
  This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, 1 /* Error */, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."),
9497
- Convert_to_type_only_import: diag(1373, 3 /* Message */, "Convert_to_type_only_import_1373", "Convert to type-only import"),
9498
- Convert_all_imports_not_used_as_a_value_to_type_only_imports: diag(1374, 3 /* Message */, "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374", "Convert all imports not used as a value to type-only imports"),
9499
9497
  await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, 1 /* Error */, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
9500
9498
  _0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
9501
9499
  _0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
@@ -10701,6 +10699,8 @@ var Diagnostics = {
10701
10699
  Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."),
10702
10700
  Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."),
10703
10701
  Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
10702
+ Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0: diag(6417, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0_6417", "Searching all ancestor node_modules directories for preferred extensions: {0}."),
10703
+ Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0: diag(6418, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418", "Searching all ancestor node_modules directories for fallback extensions: {0}."),
10704
10704
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* 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}'"),
10705
10705
  The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
10706
10706
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -11213,6 +11213,9 @@ var Diagnostics = {
11213
11213
  Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
11214
11214
  Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
11215
11215
  Cannot_move_to_file_selected_file_is_invalid: diag(95179, 3 /* Message */, "Cannot_move_to_file_selected_file_is_invalid_95179", "Cannot move to file, selected file is invalid"),
11216
+ Use_import_type: diag(95180, 3 /* Message */, "Use_import_type_95180", "Use 'import type'"),
11217
+ Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
11218
+ Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"),
11216
11219
  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."),
11217
11220
  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'."),
11218
11221
  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?"),
@@ -43080,11 +43083,13 @@ function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName,
43080
43083
  const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
43081
43084
  const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
43082
43085
  if (priorityExtensions) {
43086
+ traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0, formatExtensions(priorityExtensions));
43083
43087
  const result = lookup(priorityExtensions);
43084
43088
  if (result)
43085
43089
  return result;
43086
43090
  }
43087
43091
  if (secondaryExtensions && !typesScopeOnly) {
43092
+ traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0, formatExtensions(secondaryExtensions));
43088
43093
  return lookup(secondaryExtensions);
43089
43094
  }
43090
43095
  function lookup(extensions2) {
@@ -69365,6 +69370,8 @@ function createTypeChecker(host) {
69365
69370
  }
69366
69371
  function isConstantReference(node) {
69367
69372
  switch (node.kind) {
69373
+ case 110 /* ThisKeyword */:
69374
+ return true;
69368
69375
  case 80 /* Identifier */:
69369
69376
  if (!isThisInTypeQuery(node)) {
69370
69377
  const symbol = getResolvedSymbol(node);
@@ -100221,7 +100228,7 @@ function transformJsx(context) {
100221
100228
  continue;
100222
100229
  }
100223
100230
  finishObjectLiteralIfNeeded();
100224
- expressions.push(attr.expression);
100231
+ expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression)));
100225
100232
  continue;
100226
100233
  }
100227
100234
  properties.push(transformJsxAttributeToObjectLiteralElement(attr));
@@ -147599,19 +147606,41 @@ var fixId13 = "convertToTypeOnlyImport";
147599
147606
  registerCodeFix({
147600
147607
  errorCodes: errorCodes14,
147601
147608
  getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
147609
+ var _a;
147602
147610
  const declaration = getDeclaration2(context.sourceFile, context.span.start);
147603
147611
  if (declaration) {
147604
147612
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration));
147605
- return [createCodeFixAction(fixId13, changes, Diagnostics.Convert_to_type_only_import, fixId13, Diagnostics.Convert_all_imports_not_used_as_a_value_to_type_only_imports)];
147613
+ const importDeclarationChanges = declaration.kind === 275 /* ImportSpecifier */ && canConvertImportDeclarationForSpecifier(declaration, context.sourceFile, context.program) ? ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration.parent.parent.parent)) : void 0;
147614
+ const mainAction = createCodeFixAction(
147615
+ fixId13,
147616
+ changes,
147617
+ declaration.kind === 275 /* ImportSpecifier */ ? [Diagnostics.Use_type_0, ((_a = declaration.propertyName) == null ? void 0 : _a.text) ?? declaration.name.text] : Diagnostics.Use_import_type,
147618
+ fixId13,
147619
+ Diagnostics.Fix_all_with_type_only_imports
147620
+ );
147621
+ if (some(importDeclarationChanges)) {
147622
+ return [
147623
+ createCodeFixActionWithoutFixAll(fixId13, importDeclarationChanges, Diagnostics.Use_import_type),
147624
+ mainAction
147625
+ ];
147626
+ }
147627
+ return [mainAction];
147606
147628
  }
147607
147629
  return void 0;
147608
147630
  },
147609
147631
  fixIds: [fixId13],
147610
147632
  getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
147633
+ const fixedImportDeclarations = /* @__PURE__ */ new Set();
147611
147634
  return codeFixAll(context, errorCodes14, (changes, diag2) => {
147612
- const declaration = getDeclaration2(diag2.file, diag2.start);
147613
- if (declaration) {
147614
- doChange11(changes, diag2.file, declaration);
147635
+ const errorDeclaration = getDeclaration2(diag2.file, diag2.start);
147636
+ if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 271 /* ImportDeclaration */ && !fixedImportDeclarations.has(errorDeclaration)) {
147637
+ doChange11(changes, diag2.file, errorDeclaration);
147638
+ fixedImportDeclarations.add(errorDeclaration);
147639
+ } else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 275 /* ImportSpecifier */ && !fixedImportDeclarations.has(errorDeclaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(errorDeclaration, diag2.file, context.program)) {
147640
+ doChange11(changes, diag2.file, errorDeclaration.parent.parent.parent);
147641
+ fixedImportDeclarations.add(errorDeclaration.parent.parent.parent);
147642
+ } else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 275 /* ImportSpecifier */) {
147643
+ doChange11(changes, diag2.file, errorDeclaration);
147615
147644
  }
147616
147645
  });
147617
147646
  }
@@ -147620,7 +147649,27 @@ function getDeclaration2(sourceFile, pos) {
147620
147649
  const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
147621
147650
  return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0;
147622
147651
  }
147652
+ function canConvertImportDeclarationForSpecifier(specifier, sourceFile, program) {
147653
+ if (specifier.parent.parent.name) {
147654
+ return false;
147655
+ }
147656
+ const nonTypeOnlySpecifiers = specifier.parent.elements.filter((e) => !e.isTypeOnly);
147657
+ if (nonTypeOnlySpecifiers.length === 1) {
147658
+ return true;
147659
+ }
147660
+ const checker = program.getTypeChecker();
147661
+ for (const specifier2 of nonTypeOnlySpecifiers) {
147662
+ const isUsedAsValue = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(specifier2.name, checker, sourceFile, (usage) => {
147663
+ return !isValidTypeOnlyAliasUseSite(usage);
147664
+ });
147665
+ if (isUsedAsValue) {
147666
+ return false;
147667
+ }
147668
+ }
147669
+ return true;
147670
+ }
147623
147671
  function doChange11(changes, sourceFile, declaration) {
147672
+ var _a;
147624
147673
  if (isImportSpecifier(declaration)) {
147625
147674
  changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier(
147626
147675
  declaration,
@@ -147691,6 +147740,16 @@ function doChange11(changes, sourceFile, declaration) {
147691
147740
  )
147692
147741
  ]);
147693
147742
  } else {
147743
+ const newNamedBindings = ((_a = importClause.namedBindings) == null ? void 0 : _a.kind) === 274 /* NamedImports */ ? factory.updateNamedImports(
147744
+ importClause.namedBindings,
147745
+ sameMap(importClause.namedBindings.elements, (e) => factory.updateImportSpecifier(
147746
+ e,
147747
+ /*isTypeOnly*/
147748
+ false,
147749
+ e.propertyName,
147750
+ e.name
147751
+ ))
147752
+ ) : importClause.namedBindings;
147694
147753
  const importDeclaration = factory.updateImportDeclaration(
147695
147754
  declaration,
147696
147755
  declaration.modifiers,
@@ -147699,7 +147758,7 @@ function doChange11(changes, sourceFile, declaration) {
147699
147758
  /*isTypeOnly*/
147700
147759
  true,
147701
147760
  importClause.name,
147702
- importClause.namedBindings
147761
+ newNamedBindings
147703
147762
  ),
147704
147763
  declaration.moduleSpecifier,
147705
147764
  declaration.assertClause
@@ -151388,7 +151447,7 @@ registerCodeFix({
151388
151447
  actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import));
151389
151448
  }
151390
151449
  if (typeOnlyChanges.length) {
151391
- actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Convert_to_type_only_import));
151450
+ actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Use_import_type));
151392
151451
  }
151393
151452
  return actions2;
151394
151453
  },
@@ -159321,7 +159380,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
159321
159380
  }
159322
159381
  const keys = getOwnKeys(exports);
159323
159382
  const fragmentSubpath = components.join("/") + (components.length && hasTrailingDirectorySeparator(fragment) ? "/" : "");
159324
- const conditions = mode === 99 /* ESNext */ ? ["node", "import", "types"] : ["node", "require", "types"];
159383
+ const conditions = getConditions(compilerOptions, mode === 99 /* ESNext */);
159325
159384
  addCompletionEntriesFromPathsOrExports(
159326
159385
  result,
159327
159386
  fragmentSubpath,
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.2";
38
- version = `${versionMajorMinor}.0-dev.20230601`;
38
+ version = `${versionMajorMinor}.0-dev.20230603`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -7300,8 +7300,6 @@ ${lanes.join("\n")}
7300
7300
  Class_constructor_may_not_be_a_generator: diag(1368, 1 /* Error */, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."),
7301
7301
  Did_you_mean_0: diag(1369, 3 /* Message */, "Did_you_mean_0_1369", "Did you mean '{0}'?"),
7302
7302
  This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, 1 /* Error */, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."),
7303
- Convert_to_type_only_import: diag(1373, 3 /* Message */, "Convert_to_type_only_import_1373", "Convert to type-only import"),
7304
- Convert_all_imports_not_used_as_a_value_to_type_only_imports: diag(1374, 3 /* Message */, "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374", "Convert all imports not used as a value to type-only imports"),
7305
7303
  await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, 1 /* Error */, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
7306
7304
  _0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
7307
7305
  _0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
@@ -8507,6 +8505,8 @@ ${lanes.join("\n")}
8507
8505
  Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."),
8508
8506
  Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."),
8509
8507
  Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
8508
+ Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0: diag(6417, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0_6417", "Searching all ancestor node_modules directories for preferred extensions: {0}."),
8509
+ Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0: diag(6418, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418", "Searching all ancestor node_modules directories for fallback extensions: {0}."),
8510
8510
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* 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}'"),
8511
8511
  The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
8512
8512
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -9019,6 +9019,9 @@ ${lanes.join("\n")}
9019
9019
  Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
9020
9020
  Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
9021
9021
  Cannot_move_to_file_selected_file_is_invalid: diag(95179, 3 /* Message */, "Cannot_move_to_file_selected_file_is_invalid_95179", "Cannot move to file, selected file is invalid"),
9022
+ Use_import_type: diag(95180, 3 /* Message */, "Use_import_type_95180", "Use 'import type'"),
9023
+ Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
9024
+ Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"),
9022
9025
  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."),
9023
9026
  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'."),
9024
9027
  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?"),
@@ -40948,11 +40951,13 @@ ${lanes.join("\n")}
40948
40951
  const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
40949
40952
  const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
40950
40953
  if (priorityExtensions) {
40954
+ traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0, formatExtensions(priorityExtensions));
40951
40955
  const result = lookup(priorityExtensions);
40952
40956
  if (result)
40953
40957
  return result;
40954
40958
  }
40955
40959
  if (secondaryExtensions && !typesScopeOnly) {
40960
+ traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0, formatExtensions(secondaryExtensions));
40956
40961
  return lookup(secondaryExtensions);
40957
40962
  }
40958
40963
  function lookup(extensions2) {
@@ -67155,6 +67160,8 @@ ${lanes.join("\n")}
67155
67160
  }
67156
67161
  function isConstantReference(node) {
67157
67162
  switch (node.kind) {
67163
+ case 110 /* ThisKeyword */:
67164
+ return true;
67158
67165
  case 80 /* Identifier */:
67159
67166
  if (!isThisInTypeQuery(node)) {
67160
67167
  const symbol = getResolvedSymbol(node);
@@ -98247,7 +98254,7 @@ ${lanes.join("\n")}
98247
98254
  continue;
98248
98255
  }
98249
98256
  finishObjectLiteralIfNeeded();
98250
- expressions.push(attr.expression);
98257
+ expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression)));
98251
98258
  continue;
98252
98259
  }
98253
98260
  properties.push(transformJsxAttributeToObjectLiteralElement(attr));
@@ -146345,7 +146352,27 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
146345
146352
  const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
146346
146353
  return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0;
146347
146354
  }
146355
+ function canConvertImportDeclarationForSpecifier(specifier, sourceFile, program) {
146356
+ if (specifier.parent.parent.name) {
146357
+ return false;
146358
+ }
146359
+ const nonTypeOnlySpecifiers = specifier.parent.elements.filter((e) => !e.isTypeOnly);
146360
+ if (nonTypeOnlySpecifiers.length === 1) {
146361
+ return true;
146362
+ }
146363
+ const checker = program.getTypeChecker();
146364
+ for (const specifier2 of nonTypeOnlySpecifiers) {
146365
+ const isUsedAsValue = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(specifier2.name, checker, sourceFile, (usage) => {
146366
+ return !isValidTypeOnlyAliasUseSite(usage);
146367
+ });
146368
+ if (isUsedAsValue) {
146369
+ return false;
146370
+ }
146371
+ }
146372
+ return true;
146373
+ }
146348
146374
  function doChange11(changes, sourceFile, declaration) {
146375
+ var _a;
146349
146376
  if (isImportSpecifier(declaration)) {
146350
146377
  changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier(
146351
146378
  declaration,
@@ -146416,6 +146443,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
146416
146443
  )
146417
146444
  ]);
146418
146445
  } else {
146446
+ const newNamedBindings = ((_a = importClause.namedBindings) == null ? void 0 : _a.kind) === 274 /* NamedImports */ ? factory.updateNamedImports(
146447
+ importClause.namedBindings,
146448
+ sameMap(importClause.namedBindings.elements, (e) => factory.updateImportSpecifier(
146449
+ e,
146450
+ /*isTypeOnly*/
146451
+ false,
146452
+ e.propertyName,
146453
+ e.name
146454
+ ))
146455
+ ) : importClause.namedBindings;
146419
146456
  const importDeclaration = factory.updateImportDeclaration(
146420
146457
  declaration,
146421
146458
  declaration.modifiers,
@@ -146424,7 +146461,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
146424
146461
  /*isTypeOnly*/
146425
146462
  true,
146426
146463
  importClause.name,
146427
- importClause.namedBindings
146464
+ newNamedBindings
146428
146465
  ),
146429
146466
  declaration.moduleSpecifier,
146430
146467
  declaration.assertClause
@@ -146447,19 +146484,41 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
146447
146484
  registerCodeFix({
146448
146485
  errorCodes: errorCodes14,
146449
146486
  getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
146487
+ var _a;
146450
146488
  const declaration = getDeclaration2(context.sourceFile, context.span.start);
146451
146489
  if (declaration) {
146452
146490
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration));
146453
- return [createCodeFixAction(fixId13, changes, Diagnostics.Convert_to_type_only_import, fixId13, Diagnostics.Convert_all_imports_not_used_as_a_value_to_type_only_imports)];
146491
+ const importDeclarationChanges = declaration.kind === 275 /* ImportSpecifier */ && canConvertImportDeclarationForSpecifier(declaration, context.sourceFile, context.program) ? ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration.parent.parent.parent)) : void 0;
146492
+ const mainAction = createCodeFixAction(
146493
+ fixId13,
146494
+ changes,
146495
+ declaration.kind === 275 /* ImportSpecifier */ ? [Diagnostics.Use_type_0, ((_a = declaration.propertyName) == null ? void 0 : _a.text) ?? declaration.name.text] : Diagnostics.Use_import_type,
146496
+ fixId13,
146497
+ Diagnostics.Fix_all_with_type_only_imports
146498
+ );
146499
+ if (some(importDeclarationChanges)) {
146500
+ return [
146501
+ createCodeFixActionWithoutFixAll(fixId13, importDeclarationChanges, Diagnostics.Use_import_type),
146502
+ mainAction
146503
+ ];
146504
+ }
146505
+ return [mainAction];
146454
146506
  }
146455
146507
  return void 0;
146456
146508
  },
146457
146509
  fixIds: [fixId13],
146458
146510
  getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
146511
+ const fixedImportDeclarations = /* @__PURE__ */ new Set();
146459
146512
  return codeFixAll(context, errorCodes14, (changes, diag2) => {
146460
- const declaration = getDeclaration2(diag2.file, diag2.start);
146461
- if (declaration) {
146462
- doChange11(changes, diag2.file, declaration);
146513
+ const errorDeclaration = getDeclaration2(diag2.file, diag2.start);
146514
+ if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 271 /* ImportDeclaration */ && !fixedImportDeclarations.has(errorDeclaration)) {
146515
+ doChange11(changes, diag2.file, errorDeclaration);
146516
+ fixedImportDeclarations.add(errorDeclaration);
146517
+ } else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 275 /* ImportSpecifier */ && !fixedImportDeclarations.has(errorDeclaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(errorDeclaration, diag2.file, context.program)) {
146518
+ doChange11(changes, diag2.file, errorDeclaration.parent.parent.parent);
146519
+ fixedImportDeclarations.add(errorDeclaration.parent.parent.parent);
146520
+ } else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 275 /* ImportSpecifier */) {
146521
+ doChange11(changes, diag2.file, errorDeclaration);
146463
146522
  }
146464
146523
  });
146465
146524
  }
@@ -150389,7 +150448,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
150389
150448
  actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import));
150390
150449
  }
150391
150450
  if (typeOnlyChanges.length) {
150392
- actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Convert_to_type_only_import));
150451
+ actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Use_import_type));
150393
150452
  }
150394
150453
  return actions2;
150395
150454
  },
@@ -158596,7 +158655,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
158596
158655
  }
158597
158656
  const keys = getOwnKeys(exports);
158598
158657
  const fragmentSubpath = components.join("/") + (components.length && hasTrailingDirectorySeparator(fragment) ? "/" : "");
158599
- const conditions = mode === 99 /* ESNext */ ? ["node", "import", "types"] : ["node", "require", "types"];
158658
+ const conditions = getConditions(compilerOptions, mode === 99 /* ESNext */);
158600
158659
  addCompletionEntriesFromPathsOrExports(
158601
158660
  result,
158602
158661
  fragmentSubpath,