typescript 5.0.0-dev.20230201 → 5.0.0-dev.20230202

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.
Files changed (84) hide show
  1. package/lib/lib.d.ts +0 -2
  2. package/lib/lib.decorators.d.ts +0 -2
  3. package/lib/lib.decorators.legacy.d.ts +0 -2
  4. package/lib/lib.dom.d.ts +0 -2
  5. package/lib/lib.dom.iterable.d.ts +0 -2
  6. package/lib/lib.es2015.collection.d.ts +0 -2
  7. package/lib/lib.es2015.core.d.ts +0 -2
  8. package/lib/lib.es2015.d.ts +0 -2
  9. package/lib/lib.es2015.generator.d.ts +0 -2
  10. package/lib/lib.es2015.iterable.d.ts +0 -2
  11. package/lib/lib.es2015.promise.d.ts +0 -2
  12. package/lib/lib.es2015.proxy.d.ts +0 -2
  13. package/lib/lib.es2015.reflect.d.ts +0 -2
  14. package/lib/lib.es2015.symbol.d.ts +0 -2
  15. package/lib/lib.es2015.symbol.wellknown.d.ts +0 -2
  16. package/lib/lib.es2016.array.include.d.ts +0 -2
  17. package/lib/lib.es2016.d.ts +0 -2
  18. package/lib/lib.es2016.full.d.ts +0 -2
  19. package/lib/lib.es2017.d.ts +0 -2
  20. package/lib/lib.es2017.full.d.ts +0 -2
  21. package/lib/lib.es2017.intl.d.ts +0 -2
  22. package/lib/lib.es2017.object.d.ts +0 -2
  23. package/lib/lib.es2017.sharedmemory.d.ts +0 -2
  24. package/lib/lib.es2017.string.d.ts +0 -2
  25. package/lib/lib.es2017.typedarrays.d.ts +0 -2
  26. package/lib/lib.es2018.asyncgenerator.d.ts +0 -2
  27. package/lib/lib.es2018.asynciterable.d.ts +0 -2
  28. package/lib/lib.es2018.d.ts +0 -2
  29. package/lib/lib.es2018.full.d.ts +0 -2
  30. package/lib/lib.es2018.intl.d.ts +0 -2
  31. package/lib/lib.es2018.promise.d.ts +0 -2
  32. package/lib/lib.es2018.regexp.d.ts +0 -2
  33. package/lib/lib.es2019.array.d.ts +0 -2
  34. package/lib/lib.es2019.d.ts +0 -2
  35. package/lib/lib.es2019.full.d.ts +0 -2
  36. package/lib/lib.es2019.intl.d.ts +0 -2
  37. package/lib/lib.es2019.object.d.ts +0 -2
  38. package/lib/lib.es2019.string.d.ts +0 -2
  39. package/lib/lib.es2019.symbol.d.ts +0 -2
  40. package/lib/lib.es2020.bigint.d.ts +0 -2
  41. package/lib/lib.es2020.d.ts +0 -2
  42. package/lib/lib.es2020.date.d.ts +0 -2
  43. package/lib/lib.es2020.full.d.ts +0 -2
  44. package/lib/lib.es2020.intl.d.ts +0 -2
  45. package/lib/lib.es2020.number.d.ts +0 -2
  46. package/lib/lib.es2020.promise.d.ts +0 -2
  47. package/lib/lib.es2020.sharedmemory.d.ts +0 -2
  48. package/lib/lib.es2020.string.d.ts +0 -2
  49. package/lib/lib.es2020.symbol.wellknown.d.ts +0 -2
  50. package/lib/lib.es2021.d.ts +0 -2
  51. package/lib/lib.es2021.full.d.ts +0 -2
  52. package/lib/lib.es2021.intl.d.ts +0 -2
  53. package/lib/lib.es2021.promise.d.ts +0 -2
  54. package/lib/lib.es2021.string.d.ts +0 -2
  55. package/lib/lib.es2021.weakref.d.ts +0 -2
  56. package/lib/lib.es2022.array.d.ts +0 -2
  57. package/lib/lib.es2022.d.ts +0 -2
  58. package/lib/lib.es2022.error.d.ts +0 -2
  59. package/lib/lib.es2022.full.d.ts +0 -2
  60. package/lib/lib.es2022.intl.d.ts +0 -2
  61. package/lib/lib.es2022.object.d.ts +0 -2
  62. package/lib/lib.es2022.regexp.d.ts +0 -2
  63. package/lib/lib.es2022.sharedmemory.d.ts +0 -2
  64. package/lib/lib.es2022.string.d.ts +0 -2
  65. package/lib/lib.es2023.array.d.ts +0 -2
  66. package/lib/lib.es2023.d.ts +0 -2
  67. package/lib/lib.es2023.full.d.ts +0 -2
  68. package/lib/lib.es5.d.ts +0 -2
  69. package/lib/lib.es6.d.ts +0 -2
  70. package/lib/lib.esnext.d.ts +0 -2
  71. package/lib/lib.esnext.full.d.ts +0 -2
  72. package/lib/lib.esnext.intl.d.ts +0 -2
  73. package/lib/lib.scripthost.d.ts +0 -2
  74. package/lib/lib.webworker.d.ts +0 -2
  75. package/lib/lib.webworker.importscripts.d.ts +0 -2
  76. package/lib/lib.webworker.iterable.d.ts +0 -2
  77. package/lib/tsc.js +20 -17
  78. package/lib/tsserver.js +31 -22
  79. package/lib/tsserverlibrary.d.ts +16 -0
  80. package/lib/tsserverlibrary.js +31 -22
  81. package/lib/typescript.d.ts +16 -0
  82. package/lib/typescript.js +31 -22
  83. package/lib/typingsInstaller.js +3 -4
  84. package/package.json +1 -1
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  interface String {
22
20
  /**
23
21
  * Replace all instances of a substring in a string, using a regular expression or search string.
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  interface WeakRef<T extends object> {
22
20
  readonly [Symbol.toStringTag]: "WeakRef";
23
21
 
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  interface Array<T> {
22
20
  /**
23
21
  * Returns the item located at the specified index.
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  /// <reference lib="es2021" />
22
20
  /// <reference lib="es2022.array" />
23
21
  /// <reference lib="es2022.error" />
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  interface ErrorOptions {
22
20
  cause?: unknown;
23
21
  }
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  /// <reference lib="es2022" />
22
20
  /// <reference lib="dom" />
23
21
  /// <reference lib="webworker.importscripts" />
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  declare namespace Intl {
22
20
 
23
21
  /**
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  interface ObjectConstructor {
22
20
  /**
23
21
  * Determines whether an object has a property with the specified name.
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  interface RegExpMatchArray {
22
20
  indices?: RegExpIndicesArray;
23
21
  }
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  interface Atomics {
22
20
  /**
23
21
  * A non-blocking, asynchronous version of wait which is usable on the main thread.
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  interface String {
22
20
  /**
23
21
  * Returns a new String consisting of the single UTF-16 code unit located at the specified index.
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  interface Array<T> {
22
20
  /**
23
21
  * Returns the value of the last element in the array where predicate is true, and undefined
@@ -14,9 +14,7 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  /// <reference lib="es2022" />
22
20
  /// <reference lib="es2023.array" />
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  /// <reference lib="es2023" />
22
20
  /// <reference lib="dom" />
23
21
  /// <reference lib="webworker.importscripts" />
package/lib/lib.es5.d.ts CHANGED
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  /// <reference lib="decorators" />
22
20
  /// <reference lib="decorators.legacy" />
23
21
 
package/lib/lib.es6.d.ts CHANGED
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  /// <reference lib="es2015" />
22
20
  /// <reference lib="dom" />
23
21
  /// <reference lib="dom.iterable" />
@@ -14,9 +14,7 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  /// <reference lib="es2023" />
22
20
  /// <reference lib="esnext.intl" />
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  /// <reference lib="esnext" />
22
20
  /// <reference lib="dom" />
23
21
  /// <reference lib="webworker.importscripts" />
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  declare namespace Intl {
22
20
  interface NumberRangeFormatPart extends NumberFormatPart {
23
21
  source: "startRange" | "endRange" | "shared"
@@ -14,12 +14,10 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
19
 
21
20
 
22
-
23
21
  /////////////////////////////
24
22
  /// Windows Script Host APIS
25
23
  /////////////////////////////
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  /////////////////////////////
22
20
  /// Worker APIs
23
21
  /////////////////////////////
@@ -14,11 +14,9 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
19
 
21
-
22
20
  /////////////////////////////
23
21
  /// WorkerGlobalScope APIs
24
22
  /////////////////////////////
@@ -14,10 +14,8 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
 
17
-
18
17
  /// <reference no-default-lib="true"/>
19
18
 
20
-
21
19
  /////////////////////////////
22
20
  /// Worker Iterable APIs
23
21
  /////////////////////////////
package/lib/tsc.js CHANGED
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.0";
26
- var version = `${versionMajorMinor}.0-dev.20230201`;
26
+ var version = `${versionMajorMinor}.0-dev.20230202`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -6051,7 +6051,6 @@ var Diagnostics = {
6051
6051
  Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, 1 /* Error */, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
6052
6052
  Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, 1 /* Error */, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
6053
6053
  Class_constructor_may_not_be_an_accessor: diag(1341, 1 /* Error */, "Class_constructor_may_not_be_an_accessor_1341", "Class constructor may not be an accessor."),
6054
- Type_arguments_cannot_be_used_here: diag(1342, 1 /* Error */, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
6055
6054
  The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, 1 /* Error */, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."),
6056
6055
  A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
6057
6056
  An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, 1 /* Error */, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
@@ -6697,7 +6696,7 @@ var Diagnostics = {
6697
6696
  Private_accessor_was_defined_without_a_getter: diag(2806, 1 /* Error */, "Private_accessor_was_defined_without_a_getter_2806", "Private accessor was defined without a getter."),
6698
6697
  This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, 1 /* Error */, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
6699
6698
  A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, 1 /* Error */, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
6700
- Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses."),
6699
+ Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses."),
6701
6700
  Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments: diag(2810, 1 /* Error */, "Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810", "Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),
6702
6701
  Initializer_for_property_0: diag(2811, 1 /* Error */, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
6703
6702
  Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, 1 /* Error */, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
@@ -10712,6 +10711,9 @@ function isFunctionLikeOrClassStaticBlockDeclaration(node) {
10712
10711
  function isFunctionLikeDeclaration(node) {
10713
10712
  return node && isFunctionLikeDeclarationKind(node.kind);
10714
10713
  }
10714
+ function isBooleanLiteral(node) {
10715
+ return node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */;
10716
+ }
10715
10717
  function isFunctionLikeDeclarationKind(kind) {
10716
10718
  switch (kind) {
10717
10719
  case 259 /* FunctionDeclaration */:
@@ -29623,7 +29625,7 @@ var Parser;
29623
29625
  parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
29624
29626
  const result = withJSDoc(finishNode(factory2.createBlock(statements, multiLine), pos), hasJSDoc);
29625
29627
  if (token() === 63 /* EqualsToken */) {
29626
- parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses);
29628
+ parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses);
29627
29629
  nextToken();
29628
29630
  }
29629
29631
  return result;
@@ -41833,8 +41835,10 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
41833
41835
  const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
41834
41836
  const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
41835
41837
  if (getResolvePackageJsonExports(options)) {
41838
+ const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
41839
+ const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
41836
41840
  const conditions = getConditions(options, importMode === 99 /* ESNext */);
41837
- const fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, getPackageNameFromTypesPackageName(packageJsonContent.name), packageJsonContent.exports, conditions) : void 0;
41841
+ const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
41838
41842
  if (fromExports) {
41839
41843
  const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
41840
41844
  return { ...withJsExtension, verbatimFromExports: true };
@@ -55417,7 +55421,7 @@ function createTypeChecker(host) {
55417
55421
  function typePredicateKindsMatch(a, b) {
55418
55422
  return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
55419
55423
  }
55420
- function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, origin) {
55424
+ function getUnionTypeFromSortedList(types, precomputedObjectFlags, aliasSymbol, aliasTypeArguments, origin) {
55421
55425
  if (types.length === 0) {
55422
55426
  return neverType;
55423
55427
  }
@@ -55429,7 +55433,7 @@ function createTypeChecker(host) {
55429
55433
  let type = unionTypes.get(id);
55430
55434
  if (!type) {
55431
55435
  type = createType(1048576 /* Union */);
55432
- type.objectFlags = objectFlags | getPropagatingFlagsOfTypes(
55436
+ type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
55433
55437
  types,
55434
55438
  /*excludeKinds*/
55435
55439
  98304 /* Nullable */
@@ -56606,11 +56610,6 @@ function createTypeChecker(host) {
56606
56610
  var _a2;
56607
56611
  const links = getNodeLinks(node);
56608
56612
  if (!links.resolvedType) {
56609
- if (node.isTypeOf && node.typeArguments) {
56610
- error(node, Diagnostics.Type_arguments_cannot_be_used_here);
56611
- links.resolvedSymbol = unknownSymbol;
56612
- return links.resolvedType = errorType;
56613
- }
56614
56613
  if (!isLiteralImportTypeNode(node)) {
56615
56614
  error(node.argument, Diagnostics.String_literal_expected);
56616
56615
  links.resolvedSymbol = unknownSymbol;
@@ -56671,7 +56670,7 @@ function createTypeChecker(host) {
56671
56670
  const resolvedSymbol = resolveSymbol(symbol);
56672
56671
  links.resolvedSymbol = resolvedSymbol;
56673
56672
  if (meaning === 111551 /* Value */) {
56674
- return getTypeOfSymbol(symbol);
56673
+ return getInstantiationExpressionType(getTypeOfSymbol(symbol), node);
56675
56674
  } else {
56676
56675
  const type = tryGetDeclaredTypeOfSymbol(resolvedSymbol);
56677
56676
  const typeParameters = type && getTypeParametersForTypeAndSymbol(type, resolvedSymbol);
@@ -58749,7 +58748,8 @@ function createTypeChecker(host) {
58749
58748
  Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
58750
58749
  generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
58751
58750
  }
58752
- if (target2.flags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
58751
+ const targetFlags = target2.flags & 8388608 /* IndexedAccess */ && !(source2.flags & 8388608 /* IndexedAccess */) ? target2.objectType.flags : target2.flags;
58752
+ if (targetFlags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
58753
58753
  const constraint = getBaseConstraintOfType(target2);
58754
58754
  let needsOriginalSource;
58755
58755
  if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source2, constraint)))) {
@@ -63417,7 +63417,7 @@ function createTypeChecker(host) {
63417
63417
  }
63418
63418
  return getUnionTypeFromSortedList(
63419
63419
  filtered,
63420
- type.objectFlags,
63420
+ type.objectFlags & (32768 /* PrimitiveUnion */ | 16777216 /* ContainsIntersections */),
63421
63421
  /*aliasSymbol*/
63422
63422
  void 0,
63423
63423
  /*aliasTypeArguments*/
@@ -70399,6 +70399,9 @@ function createTypeChecker(host) {
70399
70399
  checkGrammarExpressionWithTypeArguments(node);
70400
70400
  forEach(node.typeArguments, checkSourceElement);
70401
70401
  const exprType = node.kind === 230 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
70402
+ return getInstantiationExpressionType(exprType, node);
70403
+ }
70404
+ function getInstantiationExpressionType(exprType, node) {
70402
70405
  const typeArguments = node.typeArguments;
70403
70406
  if (exprType === silentNeverType || isErrorType(exprType) || !some(typeArguments)) {
70404
70407
  return exprType;
@@ -73037,7 +73040,7 @@ function createTypeChecker(host) {
73037
73040
  return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
73038
73041
  } else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
73039
73042
  return getTypeFromTypeNode(expr.type);
73040
- } else if (node.kind === 8 /* NumericLiteral */ || node.kind === 10 /* StringLiteral */ || node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */) {
73043
+ } else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
73041
73044
  return checkExpression(node);
73042
73045
  }
73043
73046
  return void 0;
@@ -103891,7 +103894,7 @@ function transformDeclarations(context) {
103891
103894
  if (elem.kind === 229 /* OmittedExpression */) {
103892
103895
  return elem;
103893
103896
  }
103894
- if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced) {
103897
+ if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
103895
103898
  return factory2.updateBindingElement(
103896
103899
  elem,
103897
103900
  elem.dotDotDotToken,
package/lib/tsserver.js CHANGED
@@ -2378,7 +2378,7 @@ __export(ts_server_exports3, {
2378
2378
 
2379
2379
  // src/compiler/corePublic.ts
2380
2380
  var versionMajorMinor = "5.0";
2381
- var version = `${versionMajorMinor}.0-dev.20230201`;
2381
+ var version = `${versionMajorMinor}.0-dev.20230202`;
2382
2382
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2383
2383
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2384
2384
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -9606,7 +9606,6 @@ var Diagnostics = {
9606
9606
  Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, 1 /* Error */, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
9607
9607
  Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, 1 /* Error */, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
9608
9608
  Class_constructor_may_not_be_an_accessor: diag(1341, 1 /* Error */, "Class_constructor_may_not_be_an_accessor_1341", "Class constructor may not be an accessor."),
9609
- Type_arguments_cannot_be_used_here: diag(1342, 1 /* Error */, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
9610
9609
  The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, 1 /* Error */, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."),
9611
9610
  A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
9612
9611
  An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, 1 /* Error */, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
@@ -10252,7 +10251,7 @@ var Diagnostics = {
10252
10251
  Private_accessor_was_defined_without_a_getter: diag(2806, 1 /* Error */, "Private_accessor_was_defined_without_a_getter_2806", "Private accessor was defined without a getter."),
10253
10252
  This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, 1 /* Error */, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
10254
10253
  A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, 1 /* Error */, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
10255
- Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses."),
10254
+ Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses."),
10256
10255
  Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments: diag(2810, 1 /* Error */, "Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810", "Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),
10257
10256
  Initializer_for_property_0: diag(2811, 1 /* Error */, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
10258
10257
  Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, 1 /* Error */, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
@@ -34033,7 +34032,7 @@ var Parser;
34033
34032
  parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
34034
34033
  const result = withJSDoc(finishNode(factory2.createBlock(statements, multiLine), pos), hasJSDoc);
34035
34034
  if (token() === 63 /* EqualsToken */) {
34036
- parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses);
34035
+ parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses);
34037
34036
  nextToken();
34038
34037
  }
34039
34038
  return result;
@@ -46491,8 +46490,10 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
46491
46490
  const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
46492
46491
  const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
46493
46492
  if (getResolvePackageJsonExports(options)) {
46493
+ const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
46494
+ const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
46494
46495
  const conditions = getConditions(options, importMode === 99 /* ESNext */);
46495
- const fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, getPackageNameFromTypesPackageName(packageJsonContent.name), packageJsonContent.exports, conditions) : void 0;
46496
+ const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
46496
46497
  if (fromExports) {
46497
46498
  const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
46498
46499
  return { ...withJsExtension, verbatimFromExports: true };
@@ -60075,7 +60076,7 @@ function createTypeChecker(host) {
60075
60076
  function typePredicateKindsMatch(a, b) {
60076
60077
  return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
60077
60078
  }
60078
- function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, origin) {
60079
+ function getUnionTypeFromSortedList(types, precomputedObjectFlags, aliasSymbol, aliasTypeArguments, origin) {
60079
60080
  if (types.length === 0) {
60080
60081
  return neverType;
60081
60082
  }
@@ -60087,7 +60088,7 @@ function createTypeChecker(host) {
60087
60088
  let type = unionTypes.get(id);
60088
60089
  if (!type) {
60089
60090
  type = createType(1048576 /* Union */);
60090
- type.objectFlags = objectFlags | getPropagatingFlagsOfTypes(
60091
+ type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
60091
60092
  types,
60092
60093
  /*excludeKinds*/
60093
60094
  98304 /* Nullable */
@@ -61264,11 +61265,6 @@ function createTypeChecker(host) {
61264
61265
  var _a2;
61265
61266
  const links = getNodeLinks(node);
61266
61267
  if (!links.resolvedType) {
61267
- if (node.isTypeOf && node.typeArguments) {
61268
- error(node, Diagnostics.Type_arguments_cannot_be_used_here);
61269
- links.resolvedSymbol = unknownSymbol;
61270
- return links.resolvedType = errorType;
61271
- }
61272
61268
  if (!isLiteralImportTypeNode(node)) {
61273
61269
  error(node.argument, Diagnostics.String_literal_expected);
61274
61270
  links.resolvedSymbol = unknownSymbol;
@@ -61329,7 +61325,7 @@ function createTypeChecker(host) {
61329
61325
  const resolvedSymbol = resolveSymbol(symbol);
61330
61326
  links.resolvedSymbol = resolvedSymbol;
61331
61327
  if (meaning === 111551 /* Value */) {
61332
- return getTypeOfSymbol(symbol);
61328
+ return getInstantiationExpressionType(getTypeOfSymbol(symbol), node);
61333
61329
  } else {
61334
61330
  const type = tryGetDeclaredTypeOfSymbol(resolvedSymbol);
61335
61331
  const typeParameters = type && getTypeParametersForTypeAndSymbol(type, resolvedSymbol);
@@ -63407,7 +63403,8 @@ function createTypeChecker(host) {
63407
63403
  Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
63408
63404
  generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
63409
63405
  }
63410
- if (target2.flags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
63406
+ const targetFlags = target2.flags & 8388608 /* IndexedAccess */ && !(source2.flags & 8388608 /* IndexedAccess */) ? target2.objectType.flags : target2.flags;
63407
+ if (targetFlags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
63411
63408
  const constraint = getBaseConstraintOfType(target2);
63412
63409
  let needsOriginalSource;
63413
63410
  if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source2, constraint)))) {
@@ -68075,7 +68072,7 @@ function createTypeChecker(host) {
68075
68072
  }
68076
68073
  return getUnionTypeFromSortedList(
68077
68074
  filtered,
68078
- type.objectFlags,
68075
+ type.objectFlags & (32768 /* PrimitiveUnion */ | 16777216 /* ContainsIntersections */),
68079
68076
  /*aliasSymbol*/
68080
68077
  void 0,
68081
68078
  /*aliasTypeArguments*/
@@ -75057,6 +75054,9 @@ function createTypeChecker(host) {
75057
75054
  checkGrammarExpressionWithTypeArguments(node);
75058
75055
  forEach(node.typeArguments, checkSourceElement);
75059
75056
  const exprType = node.kind === 230 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
75057
+ return getInstantiationExpressionType(exprType, node);
75058
+ }
75059
+ function getInstantiationExpressionType(exprType, node) {
75060
75060
  const typeArguments = node.typeArguments;
75061
75061
  if (exprType === silentNeverType || isErrorType(exprType) || !some(typeArguments)) {
75062
75062
  return exprType;
@@ -77695,7 +77695,7 @@ function createTypeChecker(host) {
77695
77695
  return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
77696
77696
  } else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
77697
77697
  return getTypeFromTypeNode(expr.type);
77698
- } else if (node.kind === 8 /* NumericLiteral */ || node.kind === 10 /* StringLiteral */ || node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */) {
77698
+ } else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
77699
77699
  return checkExpression(node);
77700
77700
  }
77701
77701
  return void 0;
@@ -108720,7 +108720,7 @@ function transformDeclarations(context) {
108720
108720
  if (elem.kind === 229 /* OmittedExpression */) {
108721
108721
  return elem;
108722
108722
  }
108723
- if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced) {
108723
+ if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
108724
108724
  return factory2.updateBindingElement(
108725
108725
  elem,
108726
108726
  elem.dotDotDotToken,
@@ -153651,12 +153651,12 @@ function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, comp
153651
153651
  const mode = isStringLiteralLike(node) ? getModeForUsageLocation(sourceFile, node) : void 0;
153652
153652
  const scriptPath = sourceFile.path;
153653
153653
  const scriptDirectory = getDirectoryPath(scriptPath);
153654
- const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, preferences, mode);
153654
+ const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, typeChecker, preferences, mode);
153655
153655
  return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker);
153656
153656
  }
153657
- function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, preferences, resolutionMode) {
153657
+ function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
153658
153658
  return {
153659
- extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions)),
153659
+ extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker)),
153660
153660
  referenceKind,
153661
153661
  importingSourceFile,
153662
153662
  endingPreference: preferences == null ? void 0 : preferences.importModuleSpecifierEnding,
@@ -153686,8 +153686,17 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, c
153686
153686
  ).values());
153687
153687
  }
153688
153688
  }
153689
- function getSupportedExtensionsForModuleResolution(compilerOptions) {
153690
- const extensions = getSupportedExtensions(compilerOptions);
153689
+ function getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker) {
153690
+ const ambientModulesExtensions = !typeChecker ? [] : mapDefined(
153691
+ typeChecker.getAmbientModules(),
153692
+ (module2) => {
153693
+ const name = module2.name.slice(1, -1);
153694
+ if (!name.startsWith("*.") || name.includes("/"))
153695
+ return;
153696
+ return name.slice(1);
153697
+ }
153698
+ );
153699
+ const extensions = [...getSupportedExtensions(compilerOptions), ambientModulesExtensions];
153691
153700
  const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
153692
153701
  return moduleResolutionUsesNodeModules(moduleResolution) ? getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, extensions) : extensions;
153693
153702
  }
@@ -6310,6 +6310,7 @@ declare namespace ts {
6310
6310
  }
6311
6311
  interface TypeChecker {
6312
6312
  getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
6313
+ getTypeOfSymbol(symbol: Symbol): Type;
6313
6314
  getDeclaredTypeOfSymbol(symbol: Symbol): Type;
6314
6315
  getPropertiesOfType(type: Type): Symbol[];
6315
6316
  getPropertyOfType(type: Type, propertyName: string): Symbol | undefined;
@@ -6400,6 +6401,21 @@ declare namespace ts {
6400
6401
  getApparentType(type: Type): Type;
6401
6402
  getBaseConstraintOfType(type: Type): Type | undefined;
6402
6403
  getDefaultFromTypeParameter(type: Type): Type | undefined;
6404
+ /**
6405
+ * True if this type is the `Array` or `ReadonlyArray` type from lib.d.ts.
6406
+ * This function will _not_ return true if passed a type which
6407
+ * extends `Array` (for example, the TypeScript AST's `NodeArray` type).
6408
+ */
6409
+ isArrayType(type: Type): boolean;
6410
+ /**
6411
+ * True if this type is a tuple type. This function will _not_ return true if
6412
+ * passed a type which extends from a tuple.
6413
+ */
6414
+ isTupleType(type: Type): boolean;
6415
+ /**
6416
+ * True if this type is assignable to `ReadonlyArray<any>`.
6417
+ */
6418
+ isArrayLikeType(type: Type): boolean;
6403
6419
  getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined;
6404
6420
  /**
6405
6421
  * Depending on the operation performed, it may be appropriate to throw away the checker