typescript 5.0.0-dev.20230201 → 5.0.0-dev.20230203

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 +132 -60
  78. package/lib/tsserver.js +2884 -2805
  79. package/lib/tsserverlibrary.d.ts +16 -0
  80. package/lib/tsserverlibrary.js +154 -75
  81. package/lib/typescript.d.ts +16 -0
  82. package/lib/typescript.js +151 -72
  83. package/lib/typingsInstaller.js +35 -18
  84. package/package.json +2 -1
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.20230203`;
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;
@@ -35953,6 +35955,22 @@ function resolvedTypeScriptOnly(resolved) {
35953
35955
  Debug.assert(extensionIsTS(resolved.extension));
35954
35956
  return { fileName: resolved.path, packageId: resolved.packageId };
35955
35957
  }
35958
+ function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
35959
+ if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
35960
+ const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
35961
+ if (originalPath)
35962
+ resolved = { ...resolved, path: resolvedFileName, originalPath };
35963
+ }
35964
+ return createResolvedModuleWithFailedLookupLocations(
35965
+ resolved,
35966
+ isExternalLibraryImport,
35967
+ failedLookupLocations,
35968
+ affectingLocations,
35969
+ diagnostics,
35970
+ state.resultFromCache,
35971
+ legacyResult
35972
+ );
35973
+ }
35956
35974
  function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
35957
35975
  if (resultFromCache) {
35958
35976
  resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
@@ -36113,6 +36131,15 @@ function arePathsEqual(path1, path2, host) {
36113
36131
  const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
36114
36132
  return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */;
36115
36133
  }
36134
+ function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
36135
+ const resolvedFileName = realPath(fileName, host, traceEnabled);
36136
+ const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
36137
+ return {
36138
+ // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
36139
+ resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
36140
+ originalPath: pathsAreEqual ? void 0 : fileName
36141
+ };
36142
+ }
36116
36143
  function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
36117
36144
  Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
36118
36145
  const traceEnabled = isTraceEnabled(options, host);
@@ -36184,13 +36211,13 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
36184
36211
  let resolvedTypeReferenceDirective;
36185
36212
  if (resolved) {
36186
36213
  const { fileName, packageId } = resolved;
36187
- const resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled);
36188
- const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
36214
+ let resolvedFileName = fileName, originalPath;
36215
+ if (!options.preserveSymlinks)
36216
+ ({ resolvedFileName, originalPath } = getOriginalAndResolvedFileName(fileName, host, traceEnabled));
36189
36217
  resolvedTypeReferenceDirective = {
36190
36218
  primary,
36191
- // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
36192
- resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
36193
- originalPath: pathsAreEqual ? void 0 : fileName,
36219
+ resolvedFileName,
36220
+ originalPath,
36194
36221
  packageId,
36195
36222
  isExternalLibraryImport: pathContainsNodeModules(fileName)
36196
36223
  };
@@ -37048,13 +37075,14 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
37048
37075
  legacyResult = diagnosticResult.value.resolved.path;
37049
37076
  }
37050
37077
  }
37051
- return createResolvedModuleWithFailedLookupLocations(
37078
+ return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
37079
+ moduleName,
37052
37080
  (_c = result == null ? void 0 : result.value) == null ? void 0 : _c.resolved,
37053
37081
  (_d = result == null ? void 0 : result.value) == null ? void 0 : _d.isExternalLibraryImport,
37054
37082
  failedLookupLocations,
37055
37083
  affectingLocations,
37056
37084
  diagnostics,
37057
- state.resultFromCache,
37085
+ state,
37058
37086
  legacyResult
37059
37087
  );
37060
37088
  function tryResolve(extensions2, state2) {
@@ -37084,16 +37112,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
37084
37112
  }
37085
37113
  resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
37086
37114
  }
37087
- if (!resolved2)
37088
- return void 0;
37089
- let resolvedValue = resolved2.value;
37090
- if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) {
37091
- const path = realPath(resolvedValue.path, host, traceEnabled);
37092
- const pathsAreEqual = arePathsEqual(path, resolvedValue.path, host);
37093
- const originalPath = pathsAreEqual ? void 0 : resolvedValue.path;
37094
- resolvedValue = { ...resolvedValue, path: pathsAreEqual ? resolvedValue.path : path, originalPath };
37095
- }
37096
- return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
37115
+ return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
37097
37116
  } else {
37098
37117
  const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
37099
37118
  const resolved2 = nodeLoadModuleByRelativeName(
@@ -38148,13 +38167,14 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
38148
38167
  candidateIsFromPackageJsonField: false
38149
38168
  };
38150
38169
  const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
38151
- return createResolvedModuleWithFailedLookupLocations(
38170
+ return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
38171
+ moduleName,
38152
38172
  resolved && resolved.value,
38153
38173
  (resolved == null ? void 0 : resolved.value) && pathContainsNodeModules(resolved.value.path),
38154
38174
  failedLookupLocations,
38155
38175
  affectingLocations,
38156
38176
  diagnostics,
38157
- state.resultFromCache
38177
+ state
38158
38178
  );
38159
38179
  function tryResolve(extensions) {
38160
38180
  const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
@@ -41833,8 +41853,10 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
41833
41853
  const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
41834
41854
  const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
41835
41855
  if (getResolvePackageJsonExports(options)) {
41856
+ const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
41857
+ const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
41836
41858
  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;
41859
+ const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
41838
41860
  if (fromExports) {
41839
41861
  const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
41840
41862
  return { ...withJsExtension, verbatimFromExports: true };
@@ -44300,7 +44322,12 @@ function createTypeChecker(host) {
44300
44322
  }
44301
44323
  function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
44302
44324
  const exportValue = moduleSymbol.exports.get("export=" /* ExportEquals */);
44303
- const exportSymbol = exportValue ? getPropertyOfType(getTypeOfSymbol(exportValue), name) : moduleSymbol.exports.get(name);
44325
+ const exportSymbol = exportValue ? getPropertyOfType(
44326
+ getTypeOfSymbol(exportValue),
44327
+ name,
44328
+ /*skipObjectFunctionPropertyAugment*/
44329
+ true
44330
+ ) : moduleSymbol.exports.get(name);
44304
44331
  const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
44305
44332
  markSymbolOfAliasDeclarationIfTypeOnly(
44306
44333
  sourceNode,
@@ -53715,7 +53742,7 @@ function createTypeChecker(host) {
53715
53742
  for (const tag of node.tags) {
53716
53743
  if (isJSDocOverloadTag(tag)) {
53717
53744
  const jsDocSignature = tag.typeExpression;
53718
- if (jsDocSignature.type === void 0) {
53745
+ if (jsDocSignature.type === void 0 && !isConstructorDeclaration(decl)) {
53719
53746
  reportImplicitAny(jsDocSignature, anyType);
53720
53747
  }
53721
53748
  result.push(getSignatureFromDeclaration(jsDocSignature));
@@ -53827,6 +53854,12 @@ function createTypeChecker(host) {
53827
53854
  if (declaration.kind === 173 /* Constructor */) {
53828
53855
  return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
53829
53856
  }
53857
+ if (isJSDocSignature(declaration)) {
53858
+ const root = getJSDocRoot(declaration);
53859
+ if (root && isConstructorDeclaration(root.parent)) {
53860
+ return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
53861
+ }
53862
+ }
53830
53863
  if (isJSDocConstructSignature(declaration)) {
53831
53864
  return getTypeFromTypeNode(declaration.parameters[0].type);
53832
53865
  }
@@ -55417,7 +55450,7 @@ function createTypeChecker(host) {
55417
55450
  function typePredicateKindsMatch(a, b) {
55418
55451
  return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
55419
55452
  }
55420
- function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, origin) {
55453
+ function getUnionTypeFromSortedList(types, precomputedObjectFlags, aliasSymbol, aliasTypeArguments, origin) {
55421
55454
  if (types.length === 0) {
55422
55455
  return neverType;
55423
55456
  }
@@ -55429,7 +55462,7 @@ function createTypeChecker(host) {
55429
55462
  let type = unionTypes.get(id);
55430
55463
  if (!type) {
55431
55464
  type = createType(1048576 /* Union */);
55432
- type.objectFlags = objectFlags | getPropagatingFlagsOfTypes(
55465
+ type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
55433
55466
  types,
55434
55467
  /*excludeKinds*/
55435
55468
  98304 /* Nullable */
@@ -56606,11 +56639,6 @@ function createTypeChecker(host) {
56606
56639
  var _a2;
56607
56640
  const links = getNodeLinks(node);
56608
56641
  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
56642
  if (!isLiteralImportTypeNode(node)) {
56615
56643
  error(node.argument, Diagnostics.String_literal_expected);
56616
56644
  links.resolvedSymbol = unknownSymbol;
@@ -56671,7 +56699,7 @@ function createTypeChecker(host) {
56671
56699
  const resolvedSymbol = resolveSymbol(symbol);
56672
56700
  links.resolvedSymbol = resolvedSymbol;
56673
56701
  if (meaning === 111551 /* Value */) {
56674
- return getTypeOfSymbol(symbol);
56702
+ return getInstantiationExpressionType(getTypeOfSymbol(symbol), node);
56675
56703
  } else {
56676
56704
  const type = tryGetDeclaredTypeOfSymbol(resolvedSymbol);
56677
56705
  const typeParameters = type && getTypeParametersForTypeAndSymbol(type, resolvedSymbol);
@@ -58552,7 +58580,6 @@ function createTypeChecker(host) {
58552
58580
  let overrideNextErrorInfo = 0;
58553
58581
  let lastSkippedInfo;
58554
58582
  let incompatibleStack;
58555
- let inPropertyCheck = false;
58556
58583
  Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
58557
58584
  const result = isRelatedTo(
58558
58585
  source,
@@ -58749,7 +58776,8 @@ function createTypeChecker(host) {
58749
58776
  Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
58750
58777
  generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
58751
58778
  }
58752
- if (target2.flags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
58779
+ const targetFlags = target2.flags & 8388608 /* IndexedAccess */ && !(source2.flags & 8388608 /* IndexedAccess */) ? target2.objectType.flags : target2.flags;
58780
+ if (targetFlags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
58753
58781
  const constraint = getBaseConstraintOfType(target2);
58754
58782
  let needsOriginalSource;
58755
58783
  if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source2, constraint)))) {
@@ -59510,14 +59538,15 @@ function createTypeChecker(host) {
59510
59538
  );
59511
59539
  }
59512
59540
  }
59513
- if (result2 && !inPropertyCheck && (target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */) || isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */)))) {
59514
- inPropertyCheck = true;
59541
+ if (result2 && !(intersectionState & 2 /* Target */) && target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
59515
59542
  result2 &= propertiesRelatedTo(
59516
59543
  source2,
59517
59544
  target2,
59518
59545
  reportErrors2,
59519
59546
  /*excludedProperties*/
59520
59547
  void 0,
59548
+ /*optionalsOnly*/
59549
+ false,
59521
59550
  0 /* None */
59522
59551
  );
59523
59552
  if (result2 && isObjectLiteralType(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */) {
@@ -59530,7 +59559,17 @@ function createTypeChecker(host) {
59530
59559
  0 /* None */
59531
59560
  );
59532
59561
  }
59533
- inPropertyCheck = false;
59562
+ } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
59563
+ result2 &= propertiesRelatedTo(
59564
+ source2,
59565
+ target2,
59566
+ reportErrors2,
59567
+ /*excludedProperties*/
59568
+ void 0,
59569
+ /*optionalsOnly*/
59570
+ true,
59571
+ intersectionState
59572
+ );
59534
59573
  }
59535
59574
  }
59536
59575
  if (result2) {
@@ -60020,12 +60059,14 @@ function createTypeChecker(host) {
60020
60059
  reportStructuralErrors,
60021
60060
  /*excludedProperties*/
60022
60061
  void 0,
60062
+ /*optionalsOnly*/
60063
+ false,
60023
60064
  intersectionState
60024
60065
  );
60025
60066
  if (result2) {
60026
- result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors);
60067
+ result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors, intersectionState);
60027
60068
  if (result2) {
60028
- result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors);
60069
+ result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors, intersectionState);
60029
60070
  if (result2) {
60030
60071
  result2 &= indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportStructuralErrors, intersectionState);
60031
60072
  }
@@ -60154,6 +60195,8 @@ function createTypeChecker(host) {
60154
60195
  /*reportErrors*/
60155
60196
  false,
60156
60197
  excludedProperties,
60198
+ /*optionalsOnly*/
60199
+ false,
60157
60200
  0 /* None */
60158
60201
  );
60159
60202
  if (result2) {
@@ -60162,7 +60205,8 @@ function createTypeChecker(host) {
60162
60205
  type,
60163
60206
  0 /* Call */,
60164
60207
  /*reportStructuralErrors*/
60165
- false
60208
+ false,
60209
+ 0 /* None */
60166
60210
  );
60167
60211
  if (result2) {
60168
60212
  result2 &= signaturesRelatedTo(
@@ -60170,7 +60214,8 @@ function createTypeChecker(host) {
60170
60214
  type,
60171
60215
  1 /* Construct */,
60172
60216
  /*reportStructuralErrors*/
60173
- false
60217
+ false,
60218
+ 0 /* None */
60174
60219
  );
60175
60220
  if (result2 && !(isTupleType(source2) && isTupleType(type))) {
60176
60221
  result2 &= indexSignaturesRelatedTo(
@@ -60348,7 +60393,7 @@ function createTypeChecker(host) {
60348
60393
  }
60349
60394
  }
60350
60395
  }
60351
- function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, intersectionState) {
60396
+ function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, optionalsOnly, intersectionState) {
60352
60397
  if (relation === identityRelation) {
60353
60398
  return propertiesIdenticalTo(source2, target2, excludedProperties);
60354
60399
  }
@@ -60484,7 +60529,7 @@ function createTypeChecker(host) {
60484
60529
  const numericNamesOnly = isTupleType(source2) && isTupleType(target2);
60485
60530
  for (const targetProp of excludeProperties(properties, excludedProperties)) {
60486
60531
  const name = targetProp.escapedName;
60487
- if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
60532
+ if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length") && (!optionalsOnly || targetProp.flags & 16777216 /* Optional */)) {
60488
60533
  const sourceProp = getPropertyOfType(source2, name);
60489
60534
  if (sourceProp && sourceProp !== targetProp) {
60490
60535
  const related = propertyRelatedTo(source2, target2, sourceProp, targetProp, getNonMissingTypeOfSymbol, reportErrors2, intersectionState, relation === comparableRelation);
@@ -60520,7 +60565,7 @@ function createTypeChecker(host) {
60520
60565
  }
60521
60566
  return result2;
60522
60567
  }
60523
- function signaturesRelatedTo(source2, target2, kind, reportErrors2) {
60568
+ function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
60524
60569
  var _a3, _b;
60525
60570
  if (relation === identityRelation) {
60526
60571
  return signaturesIdenticalTo(source2, target2, kind);
@@ -60557,6 +60602,7 @@ function createTypeChecker(host) {
60557
60602
  /*erase*/
60558
60603
  true,
60559
60604
  reportErrors2,
60605
+ intersectionState,
60560
60606
  incompatibleReporter(sourceSignatures[i], targetSignatures[i])
60561
60607
  );
60562
60608
  if (!related) {
@@ -60568,7 +60614,7 @@ function createTypeChecker(host) {
60568
60614
  const eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks;
60569
60615
  const sourceSignature = first(sourceSignatures);
60570
60616
  const targetSignature = first(targetSignatures);
60571
- result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, incompatibleReporter(sourceSignature, targetSignature));
60617
+ result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
60572
60618
  if (!result2 && reportErrors2 && kind === 1 /* Construct */ && sourceObjectFlags & targetObjectFlags && (((_a3 = targetSignature.declaration) == null ? void 0 : _a3.kind) === 173 /* Constructor */ || ((_b = sourceSignature.declaration) == null ? void 0 : _b.kind) === 173 /* Constructor */)) {
60573
60619
  const constructSignatureToString = (signature) => signatureToString(
60574
60620
  signature,
@@ -60593,6 +60639,7 @@ function createTypeChecker(host) {
60593
60639
  /*erase*/
60594
60640
  true,
60595
60641
  shouldElaborateErrors,
60642
+ intersectionState,
60596
60643
  incompatibleReporter(s, t)
60597
60644
  );
60598
60645
  if (related) {
@@ -60645,7 +60692,7 @@ function createTypeChecker(host) {
60645
60692
  }
60646
60693
  return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
60647
60694
  }
60648
- function signatureRelatedTo(source2, target2, erase, reportErrors2, incompatibleReporter) {
60695
+ function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
60649
60696
  return compareSignaturesRelated(
60650
60697
  erase ? getErasedSignature(source2) : source2,
60651
60698
  erase ? getErasedSignature(target2) : target2,
@@ -60653,9 +60700,20 @@ function createTypeChecker(host) {
60653
60700
  reportErrors2,
60654
60701
  reportError,
60655
60702
  incompatibleReporter,
60656
- isRelatedToWorker,
60703
+ isRelatedToWorker2,
60657
60704
  reportUnreliableMapper
60658
60705
  );
60706
+ function isRelatedToWorker2(source3, target3, reportErrors3) {
60707
+ return isRelatedTo(
60708
+ source3,
60709
+ target3,
60710
+ 3 /* Both */,
60711
+ reportErrors3,
60712
+ /*headMessage*/
60713
+ void 0,
60714
+ intersectionState
60715
+ );
60716
+ }
60659
60717
  }
60660
60718
  function signaturesIdenticalTo(source2, target2, kind) {
60661
60719
  const sourceSignatures = getSignaturesOfType(source2, kind);
@@ -60714,7 +60772,7 @@ function createTypeChecker(host) {
60714
60772
  }
60715
60773
  for (const info of getIndexInfosOfType(source2)) {
60716
60774
  if (isApplicableIndexType(info.keyType, keyType)) {
60717
- const related = indexInfoRelatedTo(info, targetInfo, reportErrors2);
60775
+ const related = indexInfoRelatedTo(info, targetInfo, reportErrors2, intersectionState);
60718
60776
  if (!related) {
60719
60777
  return 0 /* False */;
60720
60778
  }
@@ -60723,8 +60781,16 @@ function createTypeChecker(host) {
60723
60781
  }
60724
60782
  return result2;
60725
60783
  }
60726
- function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2) {
60727
- const related = isRelatedTo(sourceInfo.type, targetInfo.type, 3 /* Both */, reportErrors2);
60784
+ function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState) {
60785
+ const related = isRelatedTo(
60786
+ sourceInfo.type,
60787
+ targetInfo.type,
60788
+ 3 /* Both */,
60789
+ reportErrors2,
60790
+ /*headMessage*/
60791
+ void 0,
60792
+ intersectionState
60793
+ );
60728
60794
  if (!related && reportErrors2) {
60729
60795
  if (sourceInfo.keyType === targetInfo.keyType) {
60730
60796
  reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
@@ -60753,7 +60819,7 @@ function createTypeChecker(host) {
60753
60819
  function typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
60754
60820
  const sourceInfo = getApplicableIndexInfo(source2, targetInfo.keyType);
60755
60821
  if (sourceInfo) {
60756
- return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2);
60822
+ return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
60757
60823
  }
60758
60824
  if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
60759
60825
  return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
@@ -61044,12 +61110,15 @@ function createTypeChecker(host) {
61044
61110
  }
61045
61111
  function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
61046
61112
  if (depth >= maxDepth) {
61113
+ if (type.flags & 2097152 /* Intersection */) {
61114
+ return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
61115
+ }
61047
61116
  const identity2 = getRecursionIdentity(type);
61048
61117
  let count = 0;
61049
61118
  let lastTypeId = 0;
61050
61119
  for (let i = 0; i < depth; i++) {
61051
61120
  const t = stack[i];
61052
- if (getRecursionIdentity(t) === identity2) {
61121
+ if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
61053
61122
  if (t.id >= lastTypeId) {
61054
61123
  count++;
61055
61124
  if (count >= maxDepth) {
@@ -63417,7 +63486,7 @@ function createTypeChecker(host) {
63417
63486
  }
63418
63487
  return getUnionTypeFromSortedList(
63419
63488
  filtered,
63420
- type.objectFlags,
63489
+ type.objectFlags & (32768 /* PrimitiveUnion */ | 16777216 /* ContainsIntersections */),
63421
63490
  /*aliasSymbol*/
63422
63491
  void 0,
63423
63492
  /*aliasTypeArguments*/
@@ -70068,7 +70137,7 @@ function createTypeChecker(host) {
70068
70137
  }
70069
70138
  }
70070
70139
  function checkCallExpression(node, checkMode) {
70071
- var _a2;
70140
+ var _a2, _b, _c;
70072
70141
  checkGrammarTypeArguments(node, node.typeArguments);
70073
70142
  const signature = getResolvedSignature(
70074
70143
  node,
@@ -70085,7 +70154,7 @@ function createTypeChecker(host) {
70085
70154
  }
70086
70155
  if (node.kind === 211 /* NewExpression */) {
70087
70156
  const declaration = signature.declaration;
70088
- if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
70157
+ if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (_a2 = getJSDocRoot(declaration)) == null ? void 0 : _a2.parent) == null ? void 0 : _b.kind) === 173 /* Constructor */) && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
70089
70158
  if (noImplicitAny) {
70090
70159
  error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
70091
70160
  }
@@ -70113,7 +70182,7 @@ function createTypeChecker(host) {
70113
70182
  /*allowDeclaration*/
70114
70183
  false
70115
70184
  );
70116
- if ((_a2 = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _a2.size) {
70185
+ if ((_c = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _c.size) {
70117
70186
  const jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, emptyArray);
70118
70187
  jsAssignmentType.objectFlags |= 4096 /* JSLiteral */;
70119
70188
  return getIntersectionType([returnType, jsAssignmentType]);
@@ -70399,6 +70468,9 @@ function createTypeChecker(host) {
70399
70468
  checkGrammarExpressionWithTypeArguments(node);
70400
70469
  forEach(node.typeArguments, checkSourceElement);
70401
70470
  const exprType = node.kind === 230 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
70471
+ return getInstantiationExpressionType(exprType, node);
70472
+ }
70473
+ function getInstantiationExpressionType(exprType, node) {
70402
70474
  const typeArguments = node.typeArguments;
70403
70475
  if (exprType === silentNeverType || isErrorType(exprType) || !some(typeArguments)) {
70404
70476
  return exprType;
@@ -73037,7 +73109,7 @@ function createTypeChecker(host) {
73037
73109
  return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
73038
73110
  } else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
73039
73111
  return getTypeFromTypeNode(expr.type);
73040
- } else if (node.kind === 8 /* NumericLiteral */ || node.kind === 10 /* StringLiteral */ || node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */) {
73112
+ } else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
73041
73113
  return checkExpression(node);
73042
73114
  }
73043
73115
  return void 0;
@@ -103891,7 +103963,7 @@ function transformDeclarations(context) {
103891
103963
  if (elem.kind === 229 /* OmittedExpression */) {
103892
103964
  return elem;
103893
103965
  }
103894
- if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced) {
103966
+ if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
103895
103967
  return factory2.updateBindingElement(
103896
103968
  elem,
103897
103969
  elem.dotDotDotToken,