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
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.0";
38
- version = `${versionMajorMinor}.0-dev.20230201`;
38
+ version = `${versionMajorMinor}.0-dev.20230202`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -7338,7 +7338,6 @@ ${lanes.join("\n")}
7338
7338
  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."),
7339
7339
  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}')'?"),
7340
7340
  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."),
7341
- Type_arguments_cannot_be_used_here: diag(1342, 1 /* Error */, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
7342
7341
  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'."),
7343
7342
  A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
7344
7343
  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."),
@@ -7984,7 +7983,7 @@ ${lanes.join("\n")}
7984
7983
  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."),
7985
7984
  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}'."),
7986
7985
  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"),
7987
- 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."),
7986
+ 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."),
7988
7987
  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."),
7989
7988
  Initializer_for_property_0: diag(2811, 1 /* Error */, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
7990
7989
  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'."),
@@ -32053,7 +32052,7 @@ ${lanes.join("\n")}
32053
32052
  parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
32054
32053
  const result = withJSDoc(finishNode(factory2.createBlock(statements, multiLine), pos), hasJSDoc);
32055
32054
  if (token() === 63 /* EqualsToken */) {
32056
- 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);
32055
+ 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);
32057
32056
  nextToken();
32058
32057
  }
32059
32058
  return result;
@@ -44307,8 +44306,10 @@ ${lanes.join("\n")}
44307
44306
  const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
44308
44307
  const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
44309
44308
  if (getResolvePackageJsonExports(options)) {
44309
+ const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
44310
+ const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
44310
44311
  const conditions = getConditions(options, importMode === 99 /* ESNext */);
44311
- const fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, getPackageNameFromTypesPackageName(packageJsonContent.name), packageJsonContent.exports, conditions) : void 0;
44312
+ const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
44312
44313
  if (fromExports) {
44313
44314
  const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
44314
44315
  return { ...withJsExtension, verbatimFromExports: true };
@@ -57794,7 +57795,7 @@ ${lanes.join("\n")}
57794
57795
  function typePredicateKindsMatch(a, b) {
57795
57796
  return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
57796
57797
  }
57797
- function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, origin) {
57798
+ function getUnionTypeFromSortedList(types, precomputedObjectFlags, aliasSymbol, aliasTypeArguments, origin) {
57798
57799
  if (types.length === 0) {
57799
57800
  return neverType;
57800
57801
  }
@@ -57806,7 +57807,7 @@ ${lanes.join("\n")}
57806
57807
  let type = unionTypes.get(id);
57807
57808
  if (!type) {
57808
57809
  type = createType(1048576 /* Union */);
57809
- type.objectFlags = objectFlags | getPropagatingFlagsOfTypes(
57810
+ type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
57810
57811
  types,
57811
57812
  /*excludeKinds*/
57812
57813
  98304 /* Nullable */
@@ -58983,11 +58984,6 @@ ${lanes.join("\n")}
58983
58984
  var _a2;
58984
58985
  const links = getNodeLinks(node);
58985
58986
  if (!links.resolvedType) {
58986
- if (node.isTypeOf && node.typeArguments) {
58987
- error(node, Diagnostics.Type_arguments_cannot_be_used_here);
58988
- links.resolvedSymbol = unknownSymbol;
58989
- return links.resolvedType = errorType;
58990
- }
58991
58987
  if (!isLiteralImportTypeNode(node)) {
58992
58988
  error(node.argument, Diagnostics.String_literal_expected);
58993
58989
  links.resolvedSymbol = unknownSymbol;
@@ -59048,7 +59044,7 @@ ${lanes.join("\n")}
59048
59044
  const resolvedSymbol = resolveSymbol(symbol);
59049
59045
  links.resolvedSymbol = resolvedSymbol;
59050
59046
  if (meaning === 111551 /* Value */) {
59051
- return getTypeOfSymbol(symbol);
59047
+ return getInstantiationExpressionType(getTypeOfSymbol(symbol), node);
59052
59048
  } else {
59053
59049
  const type = tryGetDeclaredTypeOfSymbol(resolvedSymbol);
59054
59050
  const typeParameters = type && getTypeParametersForTypeAndSymbol(type, resolvedSymbol);
@@ -61126,7 +61122,8 @@ ${lanes.join("\n")}
61126
61122
  Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
61127
61123
  generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
61128
61124
  }
61129
- if (target2.flags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
61125
+ const targetFlags = target2.flags & 8388608 /* IndexedAccess */ && !(source2.flags & 8388608 /* IndexedAccess */) ? target2.objectType.flags : target2.flags;
61126
+ if (targetFlags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
61130
61127
  const constraint = getBaseConstraintOfType(target2);
61131
61128
  let needsOriginalSource;
61132
61129
  if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source2, constraint)))) {
@@ -65794,7 +65791,7 @@ ${lanes.join("\n")}
65794
65791
  }
65795
65792
  return getUnionTypeFromSortedList(
65796
65793
  filtered,
65797
- type.objectFlags,
65794
+ type.objectFlags & (32768 /* PrimitiveUnion */ | 16777216 /* ContainsIntersections */),
65798
65795
  /*aliasSymbol*/
65799
65796
  void 0,
65800
65797
  /*aliasTypeArguments*/
@@ -72776,6 +72773,9 @@ ${lanes.join("\n")}
72776
72773
  checkGrammarExpressionWithTypeArguments(node);
72777
72774
  forEach(node.typeArguments, checkSourceElement);
72778
72775
  const exprType = node.kind === 230 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
72776
+ return getInstantiationExpressionType(exprType, node);
72777
+ }
72778
+ function getInstantiationExpressionType(exprType, node) {
72779
72779
  const typeArguments = node.typeArguments;
72780
72780
  if (exprType === silentNeverType || isErrorType(exprType) || !some(typeArguments)) {
72781
72781
  return exprType;
@@ -75414,7 +75414,7 @@ ${lanes.join("\n")}
75414
75414
  return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
75415
75415
  } else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
75416
75416
  return getTypeFromTypeNode(expr.type);
75417
- } else if (node.kind === 8 /* NumericLiteral */ || node.kind === 10 /* StringLiteral */ || node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */) {
75417
+ } else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
75418
75418
  return checkExpression(node);
75419
75419
  }
75420
75420
  return void 0;
@@ -106735,7 +106735,7 @@ ${lanes.join("\n")}
106735
106735
  if (elem.kind === 229 /* OmittedExpression */) {
106736
106736
  return elem;
106737
106737
  }
106738
- if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced) {
106738
+ if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
106739
106739
  return factory2.updateBindingElement(
106740
106740
  elem,
106741
106741
  elem.dotDotDotToken,
@@ -150311,12 +150311,12 @@ ${lanes.join("\n")}
150311
150311
  const mode = isStringLiteralLike(node) ? getModeForUsageLocation(sourceFile, node) : void 0;
150312
150312
  const scriptPath = sourceFile.path;
150313
150313
  const scriptDirectory = getDirectoryPath(scriptPath);
150314
- const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, preferences, mode);
150314
+ const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, typeChecker, preferences, mode);
150315
150315
  return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker);
150316
150316
  }
150317
- function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, preferences, resolutionMode) {
150317
+ function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
150318
150318
  return {
150319
- extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions)),
150319
+ extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker)),
150320
150320
  referenceKind,
150321
150321
  importingSourceFile,
150322
150322
  endingPreference: preferences == null ? void 0 : preferences.importModuleSpecifierEnding,
@@ -150346,8 +150346,17 @@ ${lanes.join("\n")}
150346
150346
  ).values());
150347
150347
  }
150348
150348
  }
150349
- function getSupportedExtensionsForModuleResolution(compilerOptions) {
150350
- const extensions = getSupportedExtensions(compilerOptions);
150349
+ function getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker) {
150350
+ const ambientModulesExtensions = !typeChecker ? [] : mapDefined(
150351
+ typeChecker.getAmbientModules(),
150352
+ (module2) => {
150353
+ const name = module2.name.slice(1, -1);
150354
+ if (!name.startsWith("*.") || name.includes("/"))
150355
+ return;
150356
+ return name.slice(1);
150357
+ }
150358
+ );
150359
+ const extensions = [...getSupportedExtensions(compilerOptions), ambientModulesExtensions];
150351
150360
  const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
150352
150361
  return moduleResolutionUsesNodeModules(moduleResolution) ? getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, extensions) : extensions;
150353
150362
  }
@@ -2335,6 +2335,7 @@ declare namespace ts {
2335
2335
  }
2336
2336
  interface TypeChecker {
2337
2337
  getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
2338
+ getTypeOfSymbol(symbol: Symbol): Type;
2338
2339
  getDeclaredTypeOfSymbol(symbol: Symbol): Type;
2339
2340
  getPropertiesOfType(type: Type): Symbol[];
2340
2341
  getPropertyOfType(type: Type, propertyName: string): Symbol | undefined;
@@ -2425,6 +2426,21 @@ declare namespace ts {
2425
2426
  getApparentType(type: Type): Type;
2426
2427
  getBaseConstraintOfType(type: Type): Type | undefined;
2427
2428
  getDefaultFromTypeParameter(type: Type): Type | undefined;
2429
+ /**
2430
+ * True if this type is the `Array` or `ReadonlyArray` type from lib.d.ts.
2431
+ * This function will _not_ return true if passed a type which
2432
+ * extends `Array` (for example, the TypeScript AST's `NodeArray` type).
2433
+ */
2434
+ isArrayType(type: Type): boolean;
2435
+ /**
2436
+ * True if this type is a tuple type. This function will _not_ return true if
2437
+ * passed a type which extends from a tuple.
2438
+ */
2439
+ isTupleType(type: Type): boolean;
2440
+ /**
2441
+ * True if this type is assignable to `ReadonlyArray<any>`.
2442
+ */
2443
+ isArrayLikeType(type: Type): boolean;
2428
2444
  getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined;
2429
2445
  /**
2430
2446
  * Depending on the operation performed, it may be appropriate to throw away the checker
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.0";
38
- version = `${versionMajorMinor}.0-dev.20230201`;
38
+ version = `${versionMajorMinor}.0-dev.20230202`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -7338,7 +7338,6 @@ ${lanes.join("\n")}
7338
7338
  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."),
7339
7339
  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}')'?"),
7340
7340
  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."),
7341
- Type_arguments_cannot_be_used_here: diag(1342, 1 /* Error */, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
7342
7341
  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'."),
7343
7342
  A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
7344
7343
  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."),
@@ -7984,7 +7983,7 @@ ${lanes.join("\n")}
7984
7983
  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."),
7985
7984
  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}'."),
7986
7985
  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"),
7987
- 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."),
7986
+ 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."),
7988
7987
  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."),
7989
7988
  Initializer_for_property_0: diag(2811, 1 /* Error */, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
7990
7989
  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'."),
@@ -32053,7 +32052,7 @@ ${lanes.join("\n")}
32053
32052
  parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
32054
32053
  const result = withJSDoc(finishNode(factory2.createBlock(statements, multiLine), pos), hasJSDoc);
32055
32054
  if (token() === 63 /* EqualsToken */) {
32056
- 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);
32055
+ 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);
32057
32056
  nextToken();
32058
32057
  }
32059
32058
  return result;
@@ -44307,8 +44306,10 @@ ${lanes.join("\n")}
44307
44306
  const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
44308
44307
  const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
44309
44308
  if (getResolvePackageJsonExports(options)) {
44309
+ const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
44310
+ const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
44310
44311
  const conditions = getConditions(options, importMode === 99 /* ESNext */);
44311
- const fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, getPackageNameFromTypesPackageName(packageJsonContent.name), packageJsonContent.exports, conditions) : void 0;
44312
+ const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
44312
44313
  if (fromExports) {
44313
44314
  const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
44314
44315
  return { ...withJsExtension, verbatimFromExports: true };
@@ -57794,7 +57795,7 @@ ${lanes.join("\n")}
57794
57795
  function typePredicateKindsMatch(a, b) {
57795
57796
  return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
57796
57797
  }
57797
- function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, origin) {
57798
+ function getUnionTypeFromSortedList(types, precomputedObjectFlags, aliasSymbol, aliasTypeArguments, origin) {
57798
57799
  if (types.length === 0) {
57799
57800
  return neverType;
57800
57801
  }
@@ -57806,7 +57807,7 @@ ${lanes.join("\n")}
57806
57807
  let type = unionTypes.get(id);
57807
57808
  if (!type) {
57808
57809
  type = createType(1048576 /* Union */);
57809
- type.objectFlags = objectFlags | getPropagatingFlagsOfTypes(
57810
+ type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
57810
57811
  types,
57811
57812
  /*excludeKinds*/
57812
57813
  98304 /* Nullable */
@@ -58983,11 +58984,6 @@ ${lanes.join("\n")}
58983
58984
  var _a2;
58984
58985
  const links = getNodeLinks(node);
58985
58986
  if (!links.resolvedType) {
58986
- if (node.isTypeOf && node.typeArguments) {
58987
- error(node, Diagnostics.Type_arguments_cannot_be_used_here);
58988
- links.resolvedSymbol = unknownSymbol;
58989
- return links.resolvedType = errorType;
58990
- }
58991
58987
  if (!isLiteralImportTypeNode(node)) {
58992
58988
  error(node.argument, Diagnostics.String_literal_expected);
58993
58989
  links.resolvedSymbol = unknownSymbol;
@@ -59048,7 +59044,7 @@ ${lanes.join("\n")}
59048
59044
  const resolvedSymbol = resolveSymbol(symbol);
59049
59045
  links.resolvedSymbol = resolvedSymbol;
59050
59046
  if (meaning === 111551 /* Value */) {
59051
- return getTypeOfSymbol(symbol);
59047
+ return getInstantiationExpressionType(getTypeOfSymbol(symbol), node);
59052
59048
  } else {
59053
59049
  const type = tryGetDeclaredTypeOfSymbol(resolvedSymbol);
59054
59050
  const typeParameters = type && getTypeParametersForTypeAndSymbol(type, resolvedSymbol);
@@ -61126,7 +61122,8 @@ ${lanes.join("\n")}
61126
61122
  Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
61127
61123
  generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
61128
61124
  }
61129
- if (target2.flags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
61125
+ const targetFlags = target2.flags & 8388608 /* IndexedAccess */ && !(source2.flags & 8388608 /* IndexedAccess */) ? target2.objectType.flags : target2.flags;
61126
+ if (targetFlags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
61130
61127
  const constraint = getBaseConstraintOfType(target2);
61131
61128
  let needsOriginalSource;
61132
61129
  if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source2, constraint)))) {
@@ -65794,7 +65791,7 @@ ${lanes.join("\n")}
65794
65791
  }
65795
65792
  return getUnionTypeFromSortedList(
65796
65793
  filtered,
65797
- type.objectFlags,
65794
+ type.objectFlags & (32768 /* PrimitiveUnion */ | 16777216 /* ContainsIntersections */),
65798
65795
  /*aliasSymbol*/
65799
65796
  void 0,
65800
65797
  /*aliasTypeArguments*/
@@ -72776,6 +72773,9 @@ ${lanes.join("\n")}
72776
72773
  checkGrammarExpressionWithTypeArguments(node);
72777
72774
  forEach(node.typeArguments, checkSourceElement);
72778
72775
  const exprType = node.kind === 230 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
72776
+ return getInstantiationExpressionType(exprType, node);
72777
+ }
72778
+ function getInstantiationExpressionType(exprType, node) {
72779
72779
  const typeArguments = node.typeArguments;
72780
72780
  if (exprType === silentNeverType || isErrorType(exprType) || !some(typeArguments)) {
72781
72781
  return exprType;
@@ -75414,7 +75414,7 @@ ${lanes.join("\n")}
75414
75414
  return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
75415
75415
  } else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
75416
75416
  return getTypeFromTypeNode(expr.type);
75417
- } else if (node.kind === 8 /* NumericLiteral */ || node.kind === 10 /* StringLiteral */ || node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */) {
75417
+ } else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
75418
75418
  return checkExpression(node);
75419
75419
  }
75420
75420
  return void 0;
@@ -106735,7 +106735,7 @@ ${lanes.join("\n")}
106735
106735
  if (elem.kind === 229 /* OmittedExpression */) {
106736
106736
  return elem;
106737
106737
  }
106738
- if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced) {
106738
+ if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
106739
106739
  return factory2.updateBindingElement(
106740
106740
  elem,
106741
106741
  elem.dotDotDotToken,
@@ -150325,12 +150325,12 @@ ${lanes.join("\n")}
150325
150325
  const mode = isStringLiteralLike(node) ? getModeForUsageLocation(sourceFile, node) : void 0;
150326
150326
  const scriptPath = sourceFile.path;
150327
150327
  const scriptDirectory = getDirectoryPath(scriptPath);
150328
- const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, preferences, mode);
150328
+ const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, typeChecker, preferences, mode);
150329
150329
  return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker);
150330
150330
  }
150331
- function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, preferences, resolutionMode) {
150331
+ function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
150332
150332
  return {
150333
- extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions)),
150333
+ extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker)),
150334
150334
  referenceKind,
150335
150335
  importingSourceFile,
150336
150336
  endingPreference: preferences == null ? void 0 : preferences.importModuleSpecifierEnding,
@@ -150360,8 +150360,17 @@ ${lanes.join("\n")}
150360
150360
  ).values());
150361
150361
  }
150362
150362
  }
150363
- function getSupportedExtensionsForModuleResolution(compilerOptions) {
150364
- const extensions = getSupportedExtensions(compilerOptions);
150363
+ function getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker) {
150364
+ const ambientModulesExtensions = !typeChecker ? [] : mapDefined(
150365
+ typeChecker.getAmbientModules(),
150366
+ (module2) => {
150367
+ const name = module2.name.slice(1, -1);
150368
+ if (!name.startsWith("*.") || name.includes("/"))
150369
+ return;
150370
+ return name.slice(1);
150371
+ }
150372
+ );
150373
+ const extensions = [...getSupportedExtensions(compilerOptions), ambientModulesExtensions];
150365
150374
  const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
150366
150375
  return moduleResolutionUsesNodeModules(moduleResolution) ? getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, extensions) : extensions;
150367
150376
  }
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.0";
57
- var version = `${versionMajorMinor}.0-dev.20230201`;
57
+ var version = `${versionMajorMinor}.0-dev.20230202`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -5459,7 +5459,6 @@ var Diagnostics = {
5459
5459
  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."),
5460
5460
  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}')'?"),
5461
5461
  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."),
5462
- Type_arguments_cannot_be_used_here: diag(1342, 1 /* Error */, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
5463
5462
  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'."),
5464
5463
  A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
5465
5464
  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."),
@@ -6105,7 +6104,7 @@ var Diagnostics = {
6105
6104
  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."),
6106
6105
  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}'."),
6107
6106
  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"),
6108
- 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."),
6107
+ 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."),
6109
6108
  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."),
6110
6109
  Initializer_for_property_0: diag(2811, 1 /* Error */, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
6111
6110
  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'."),
@@ -22866,7 +22865,7 @@ var Parser;
22866
22865
  parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
22867
22866
  const result = withJSDoc(finishNode(factory2.createBlock(statements, multiLine), pos), hasJSDoc);
22868
22867
  if (token() === 63 /* EqualsToken */) {
22869
- 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);
22868
+ 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);
22870
22869
  nextToken();
22871
22870
  }
22872
22871
  return result;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.0.0-dev.20230201",
5
+ "version": "5.0.0-dev.20230202",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [