typescript 5.0.0-dev.20230202 → 5.0.0-dev.20230204

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.
@@ -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.20230202`;
38
+ version = `${versionMajorMinor}.0-dev.20230204`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -7859,7 +7859,6 @@ ${lanes.join("\n")}
7859
7859
  Cannot_find_type_definition_file_for_0: diag(2688, 1 /* Error */, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."),
7860
7860
  Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, 1 /* Error */, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"),
7861
7861
  _0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0: diag(2690, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690", "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"),
7862
- An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, 1 /* Error */, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."),
7863
7862
  _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, 1 /* Error */, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
7864
7863
  _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
7865
7864
  Namespace_0_has_no_exported_member_1: diag(2694, 1 /* Error */, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
@@ -38241,6 +38240,22 @@ ${lanes.join("\n")}
38241
38240
  Debug.assert(extensionIsTS(resolved.extension));
38242
38241
  return { fileName: resolved.path, packageId: resolved.packageId };
38243
38242
  }
38243
+ function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
38244
+ if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
38245
+ const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
38246
+ if (originalPath)
38247
+ resolved = { ...resolved, path: resolvedFileName, originalPath };
38248
+ }
38249
+ return createResolvedModuleWithFailedLookupLocations(
38250
+ resolved,
38251
+ isExternalLibraryImport,
38252
+ failedLookupLocations,
38253
+ affectingLocations,
38254
+ diagnostics,
38255
+ state.resultFromCache,
38256
+ legacyResult
38257
+ );
38258
+ }
38244
38259
  function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
38245
38260
  if (resultFromCache) {
38246
38261
  resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
@@ -38399,6 +38414,15 @@ ${lanes.join("\n")}
38399
38414
  const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
38400
38415
  return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */;
38401
38416
  }
38417
+ function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
38418
+ const resolvedFileName = realPath(fileName, host, traceEnabled);
38419
+ const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
38420
+ return {
38421
+ // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
38422
+ resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
38423
+ originalPath: pathsAreEqual ? void 0 : fileName
38424
+ };
38425
+ }
38402
38426
  function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
38403
38427
  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.");
38404
38428
  const traceEnabled = isTraceEnabled(options, host);
@@ -38470,13 +38494,13 @@ ${lanes.join("\n")}
38470
38494
  let resolvedTypeReferenceDirective;
38471
38495
  if (resolved) {
38472
38496
  const { fileName, packageId } = resolved;
38473
- const resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled);
38474
- const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
38497
+ let resolvedFileName = fileName, originalPath;
38498
+ if (!options.preserveSymlinks)
38499
+ ({ resolvedFileName, originalPath } = getOriginalAndResolvedFileName(fileName, host, traceEnabled));
38475
38500
  resolvedTypeReferenceDirective = {
38476
38501
  primary,
38477
- // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
38478
- resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
38479
- originalPath: pathsAreEqual ? void 0 : fileName,
38502
+ resolvedFileName,
38503
+ originalPath,
38480
38504
  packageId,
38481
38505
  isExternalLibraryImport: pathContainsNodeModules(fileName)
38482
38506
  };
@@ -39346,13 +39370,14 @@ ${lanes.join("\n")}
39346
39370
  legacyResult = diagnosticResult.value.resolved.path;
39347
39371
  }
39348
39372
  }
39349
- return createResolvedModuleWithFailedLookupLocations(
39373
+ return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
39374
+ moduleName,
39350
39375
  (_c = result == null ? void 0 : result.value) == null ? void 0 : _c.resolved,
39351
39376
  (_d = result == null ? void 0 : result.value) == null ? void 0 : _d.isExternalLibraryImport,
39352
39377
  failedLookupLocations,
39353
39378
  affectingLocations,
39354
39379
  diagnostics,
39355
- state.resultFromCache,
39380
+ state,
39356
39381
  legacyResult
39357
39382
  );
39358
39383
  function tryResolve(extensions2, state2) {
@@ -39382,16 +39407,7 @@ ${lanes.join("\n")}
39382
39407
  }
39383
39408
  resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
39384
39409
  }
39385
- if (!resolved2)
39386
- return void 0;
39387
- let resolvedValue = resolved2.value;
39388
- if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) {
39389
- const path = realPath(resolvedValue.path, host, traceEnabled);
39390
- const pathsAreEqual = arePathsEqual(path, resolvedValue.path, host);
39391
- const originalPath = pathsAreEqual ? void 0 : resolvedValue.path;
39392
- resolvedValue = { ...resolvedValue, path: pathsAreEqual ? resolvedValue.path : path, originalPath };
39393
- }
39394
- return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
39410
+ return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
39395
39411
  } else {
39396
39412
  const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
39397
39413
  const resolved2 = nodeLoadModuleByRelativeName(
@@ -40545,13 +40561,14 @@ ${lanes.join("\n")}
40545
40561
  candidateIsFromPackageJsonField: false
40546
40562
  };
40547
40563
  const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
40548
- return createResolvedModuleWithFailedLookupLocations(
40564
+ return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
40565
+ moduleName,
40549
40566
  resolved && resolved.value,
40550
40567
  (resolved == null ? void 0 : resolved.value) && pathContainsNodeModules(resolved.value.path),
40551
40568
  failedLookupLocations,
40552
40569
  affectingLocations,
40553
40570
  diagnostics,
40554
- state.resultFromCache
40571
+ state
40555
40572
  );
40556
40573
  function tryResolve(extensions) {
40557
40574
  const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
@@ -44856,6 +44873,7 @@ ${lanes.join("\n")}
44856
44873
  isArrayType,
44857
44874
  isTupleType,
44858
44875
  isArrayLikeType,
44876
+ isEmptyAnonymousObjectType,
44859
44877
  isTypeInvalidDueToUnionDiscriminant,
44860
44878
  getExactOptionalProperties,
44861
44879
  getAllPossiblePropertiesOfTypes,
@@ -46678,7 +46696,12 @@ ${lanes.join("\n")}
46678
46696
  }
46679
46697
  function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
46680
46698
  const exportValue = moduleSymbol.exports.get("export=" /* ExportEquals */);
46681
- const exportSymbol = exportValue ? getPropertyOfType(getTypeOfSymbol(exportValue), name) : moduleSymbol.exports.get(name);
46699
+ const exportSymbol = exportValue ? getPropertyOfType(
46700
+ getTypeOfSymbol(exportValue),
46701
+ name,
46702
+ /*skipObjectFunctionPropertyAugment*/
46703
+ true
46704
+ ) : moduleSymbol.exports.get(name);
46682
46705
  const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
46683
46706
  markSymbolOfAliasDeclarationIfTypeOnly(
46684
46707
  sourceNode,
@@ -47713,12 +47736,9 @@ ${lanes.join("\n")}
47713
47736
  if (resolutionDiagnostic) {
47714
47737
  error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
47715
47738
  } else {
47716
- const tsExtension = tryExtractTSExtension(moduleReference);
47717
47739
  const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
47718
47740
  const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
47719
- if (tsExtension) {
47720
- errorOnTSExtensionImport(tsExtension);
47721
- } else if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
47741
+ if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
47722
47742
  error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
47723
47743
  } else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
47724
47744
  const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
@@ -47738,10 +47758,6 @@ ${lanes.join("\n")}
47738
47758
  }
47739
47759
  }
47740
47760
  return void 0;
47741
- function errorOnTSExtensionImport(tsExtension) {
47742
- const diag2 = Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
47743
- error(errorNode, diag2, tsExtension, getSuggestedImportSource(tsExtension));
47744
- }
47745
47761
  function getSuggestedImportSource(tsExtension) {
47746
47762
  const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
47747
47763
  if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
@@ -56093,7 +56109,7 @@ ${lanes.join("\n")}
56093
56109
  for (const tag of node.tags) {
56094
56110
  if (isJSDocOverloadTag(tag)) {
56095
56111
  const jsDocSignature = tag.typeExpression;
56096
- if (jsDocSignature.type === void 0) {
56112
+ if (jsDocSignature.type === void 0 && !isConstructorDeclaration(decl)) {
56097
56113
  reportImplicitAny(jsDocSignature, anyType);
56098
56114
  }
56099
56115
  result.push(getSignatureFromDeclaration(jsDocSignature));
@@ -56205,6 +56221,12 @@ ${lanes.join("\n")}
56205
56221
  if (declaration.kind === 173 /* Constructor */) {
56206
56222
  return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
56207
56223
  }
56224
+ if (isJSDocSignature(declaration)) {
56225
+ const root = getJSDocRoot(declaration);
56226
+ if (root && isConstructorDeclaration(root.parent)) {
56227
+ return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
56228
+ }
56229
+ }
56208
56230
  if (isJSDocConstructSignature(declaration)) {
56209
56231
  return getTypeFromTypeNode(declaration.parameters[0].type);
56210
56232
  }
@@ -56733,7 +56755,7 @@ ${lanes.join("\n")}
56733
56755
  return links.resolvedJSDocType;
56734
56756
  }
56735
56757
  function getSubstitutionType(baseType, constraint) {
56736
- if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType) {
56758
+ if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
56737
56759
  return baseType;
56738
56760
  }
56739
56761
  const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
@@ -58420,7 +58442,7 @@ ${lanes.join("\n")}
58420
58442
  }
58421
58443
  }
58422
58444
  const propType = getTypeOfSymbol(prop);
58423
- return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : propType;
58445
+ return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : accessNode && isIndexedAccessTypeNode(accessNode) && containsMissingType(propType) ? getUnionType([propType, undefinedType]) : propType;
58424
58446
  }
58425
58447
  if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
58426
58448
  const index = +propName;
@@ -60925,7 +60947,6 @@ ${lanes.join("\n")}
60925
60947
  let overrideNextErrorInfo = 0;
60926
60948
  let lastSkippedInfo;
60927
60949
  let incompatibleStack;
60928
- let inPropertyCheck = false;
60929
60950
  Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
60930
60951
  const result = isRelatedTo(
60931
60952
  source,
@@ -61884,14 +61905,15 @@ ${lanes.join("\n")}
61884
61905
  );
61885
61906
  }
61886
61907
  }
61887
- 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 */)))) {
61888
- inPropertyCheck = true;
61908
+ if (result2 && !(intersectionState & 2 /* Target */) && target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
61889
61909
  result2 &= propertiesRelatedTo(
61890
61910
  source2,
61891
61911
  target2,
61892
61912
  reportErrors2,
61893
61913
  /*excludedProperties*/
61894
61914
  void 0,
61915
+ /*optionalsOnly*/
61916
+ false,
61895
61917
  0 /* None */
61896
61918
  );
61897
61919
  if (result2 && isObjectLiteralType2(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */) {
@@ -61904,7 +61926,17 @@ ${lanes.join("\n")}
61904
61926
  0 /* None */
61905
61927
  );
61906
61928
  }
61907
- inPropertyCheck = false;
61929
+ } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
61930
+ result2 &= propertiesRelatedTo(
61931
+ source2,
61932
+ target2,
61933
+ reportErrors2,
61934
+ /*excludedProperties*/
61935
+ void 0,
61936
+ /*optionalsOnly*/
61937
+ true,
61938
+ intersectionState
61939
+ );
61908
61940
  }
61909
61941
  }
61910
61942
  if (result2) {
@@ -62394,12 +62426,14 @@ ${lanes.join("\n")}
62394
62426
  reportStructuralErrors,
62395
62427
  /*excludedProperties*/
62396
62428
  void 0,
62429
+ /*optionalsOnly*/
62430
+ false,
62397
62431
  intersectionState
62398
62432
  );
62399
62433
  if (result2) {
62400
- result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors);
62434
+ result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors, intersectionState);
62401
62435
  if (result2) {
62402
- result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors);
62436
+ result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors, intersectionState);
62403
62437
  if (result2) {
62404
62438
  result2 &= indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportStructuralErrors, intersectionState);
62405
62439
  }
@@ -62528,6 +62562,8 @@ ${lanes.join("\n")}
62528
62562
  /*reportErrors*/
62529
62563
  false,
62530
62564
  excludedProperties,
62565
+ /*optionalsOnly*/
62566
+ false,
62531
62567
  0 /* None */
62532
62568
  );
62533
62569
  if (result2) {
@@ -62536,7 +62572,8 @@ ${lanes.join("\n")}
62536
62572
  type,
62537
62573
  0 /* Call */,
62538
62574
  /*reportStructuralErrors*/
62539
- false
62575
+ false,
62576
+ 0 /* None */
62540
62577
  );
62541
62578
  if (result2) {
62542
62579
  result2 &= signaturesRelatedTo(
@@ -62544,7 +62581,8 @@ ${lanes.join("\n")}
62544
62581
  type,
62545
62582
  1 /* Construct */,
62546
62583
  /*reportStructuralErrors*/
62547
- false
62584
+ false,
62585
+ 0 /* None */
62548
62586
  );
62549
62587
  if (result2 && !(isTupleType(source2) && isTupleType(type))) {
62550
62588
  result2 &= indexSignaturesRelatedTo(
@@ -62722,7 +62760,7 @@ ${lanes.join("\n")}
62722
62760
  }
62723
62761
  }
62724
62762
  }
62725
- function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, intersectionState) {
62763
+ function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, optionalsOnly, intersectionState) {
62726
62764
  if (relation === identityRelation) {
62727
62765
  return propertiesIdenticalTo(source2, target2, excludedProperties);
62728
62766
  }
@@ -62858,7 +62896,7 @@ ${lanes.join("\n")}
62858
62896
  const numericNamesOnly = isTupleType(source2) && isTupleType(target2);
62859
62897
  for (const targetProp of excludeProperties(properties, excludedProperties)) {
62860
62898
  const name = targetProp.escapedName;
62861
- if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
62899
+ if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length") && (!optionalsOnly || targetProp.flags & 16777216 /* Optional */)) {
62862
62900
  const sourceProp = getPropertyOfType(source2, name);
62863
62901
  if (sourceProp && sourceProp !== targetProp) {
62864
62902
  const related = propertyRelatedTo(source2, target2, sourceProp, targetProp, getNonMissingTypeOfSymbol, reportErrors2, intersectionState, relation === comparableRelation);
@@ -62894,7 +62932,7 @@ ${lanes.join("\n")}
62894
62932
  }
62895
62933
  return result2;
62896
62934
  }
62897
- function signaturesRelatedTo(source2, target2, kind, reportErrors2) {
62935
+ function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
62898
62936
  var _a3, _b;
62899
62937
  if (relation === identityRelation) {
62900
62938
  return signaturesIdenticalTo(source2, target2, kind);
@@ -62931,6 +62969,7 @@ ${lanes.join("\n")}
62931
62969
  /*erase*/
62932
62970
  true,
62933
62971
  reportErrors2,
62972
+ intersectionState,
62934
62973
  incompatibleReporter(sourceSignatures[i], targetSignatures[i])
62935
62974
  );
62936
62975
  if (!related) {
@@ -62942,7 +62981,7 @@ ${lanes.join("\n")}
62942
62981
  const eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks;
62943
62982
  const sourceSignature = first(sourceSignatures);
62944
62983
  const targetSignature = first(targetSignatures);
62945
- result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, incompatibleReporter(sourceSignature, targetSignature));
62984
+ result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
62946
62985
  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 */)) {
62947
62986
  const constructSignatureToString = (signature) => signatureToString(
62948
62987
  signature,
@@ -62967,6 +63006,7 @@ ${lanes.join("\n")}
62967
63006
  /*erase*/
62968
63007
  true,
62969
63008
  shouldElaborateErrors,
63009
+ intersectionState,
62970
63010
  incompatibleReporter(s, t)
62971
63011
  );
62972
63012
  if (related) {
@@ -63019,7 +63059,7 @@ ${lanes.join("\n")}
63019
63059
  }
63020
63060
  return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
63021
63061
  }
63022
- function signatureRelatedTo(source2, target2, erase, reportErrors2, incompatibleReporter) {
63062
+ function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
63023
63063
  return compareSignaturesRelated(
63024
63064
  erase ? getErasedSignature(source2) : source2,
63025
63065
  erase ? getErasedSignature(target2) : target2,
@@ -63027,9 +63067,20 @@ ${lanes.join("\n")}
63027
63067
  reportErrors2,
63028
63068
  reportError,
63029
63069
  incompatibleReporter,
63030
- isRelatedToWorker,
63070
+ isRelatedToWorker2,
63031
63071
  reportUnreliableMapper
63032
63072
  );
63073
+ function isRelatedToWorker2(source3, target3, reportErrors3) {
63074
+ return isRelatedTo(
63075
+ source3,
63076
+ target3,
63077
+ 3 /* Both */,
63078
+ reportErrors3,
63079
+ /*headMessage*/
63080
+ void 0,
63081
+ intersectionState
63082
+ );
63083
+ }
63033
63084
  }
63034
63085
  function signaturesIdenticalTo(source2, target2, kind) {
63035
63086
  const sourceSignatures = getSignaturesOfType(source2, kind);
@@ -63088,7 +63139,7 @@ ${lanes.join("\n")}
63088
63139
  }
63089
63140
  for (const info of getIndexInfosOfType(source2)) {
63090
63141
  if (isApplicableIndexType(info.keyType, keyType)) {
63091
- const related = indexInfoRelatedTo(info, targetInfo, reportErrors2);
63142
+ const related = indexInfoRelatedTo(info, targetInfo, reportErrors2, intersectionState);
63092
63143
  if (!related) {
63093
63144
  return 0 /* False */;
63094
63145
  }
@@ -63097,8 +63148,16 @@ ${lanes.join("\n")}
63097
63148
  }
63098
63149
  return result2;
63099
63150
  }
63100
- function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2) {
63101
- const related = isRelatedTo(sourceInfo.type, targetInfo.type, 3 /* Both */, reportErrors2);
63151
+ function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState) {
63152
+ const related = isRelatedTo(
63153
+ sourceInfo.type,
63154
+ targetInfo.type,
63155
+ 3 /* Both */,
63156
+ reportErrors2,
63157
+ /*headMessage*/
63158
+ void 0,
63159
+ intersectionState
63160
+ );
63102
63161
  if (!related && reportErrors2) {
63103
63162
  if (sourceInfo.keyType === targetInfo.keyType) {
63104
63163
  reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
@@ -63127,7 +63186,7 @@ ${lanes.join("\n")}
63127
63186
  function typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
63128
63187
  const sourceInfo = getApplicableIndexInfo(source2, targetInfo.keyType);
63129
63188
  if (sourceInfo) {
63130
- return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2);
63189
+ return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
63131
63190
  }
63132
63191
  if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
63133
63192
  return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
@@ -63418,12 +63477,15 @@ ${lanes.join("\n")}
63418
63477
  }
63419
63478
  function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
63420
63479
  if (depth >= maxDepth) {
63480
+ if (type.flags & 2097152 /* Intersection */) {
63481
+ return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
63482
+ }
63421
63483
  const identity2 = getRecursionIdentity(type);
63422
63484
  let count = 0;
63423
63485
  let lastTypeId = 0;
63424
63486
  for (let i = 0; i < depth; i++) {
63425
63487
  const t = stack[i];
63426
- if (getRecursionIdentity(t) === identity2) {
63488
+ if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
63427
63489
  if (t.id >= lastTypeId) {
63428
63490
  count++;
63429
63491
  if (count >= maxDepth) {
@@ -72442,7 +72504,7 @@ ${lanes.join("\n")}
72442
72504
  }
72443
72505
  }
72444
72506
  function checkCallExpression(node, checkMode) {
72445
- var _a2;
72507
+ var _a2, _b, _c;
72446
72508
  checkGrammarTypeArguments(node, node.typeArguments);
72447
72509
  const signature = getResolvedSignature(
72448
72510
  node,
@@ -72459,7 +72521,7 @@ ${lanes.join("\n")}
72459
72521
  }
72460
72522
  if (node.kind === 211 /* NewExpression */) {
72461
72523
  const declaration = signature.declaration;
72462
- if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
72524
+ 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)) {
72463
72525
  if (noImplicitAny) {
72464
72526
  error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
72465
72527
  }
@@ -72487,7 +72549,7 @@ ${lanes.join("\n")}
72487
72549
  /*allowDeclaration*/
72488
72550
  false
72489
72551
  );
72490
- if ((_a2 = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _a2.size) {
72552
+ if ((_c = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _c.size) {
72491
72553
  const jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, emptyArray);
72492
72554
  jsAssignmentType.objectFlags |= 4096 /* JSLiteral */;
72493
72555
  return getIntersectionType([returnType, jsAssignmentType]);
@@ -80197,7 +80259,7 @@ ${lanes.join("\n")}
80197
80259
  getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
80198
80260
  }
80199
80261
  }
80200
- if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */) {
80262
+ if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
80201
80263
  const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 93 /* ExportKeyword */);
80202
80264
  if (exportModifier) {
80203
80265
  error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
@@ -84390,8 +84452,8 @@ ${lanes.join("\n")}
84390
84452
  "use strict";
84391
84453
  init_ts2();
84392
84454
  init_ts2();
84393
- init_ts_performance();
84394
84455
  init_ts_moduleSpecifiers();
84456
+ init_ts_performance();
84395
84457
  ambientModuleSymbolRegex = /^".+"$/;
84396
84458
  anon = "(anonymous)";
84397
84459
  nextSymbolId = 1;
@@ -126355,6 +126417,13 @@ ${lanes.join("\n")}
126355
126417
  }
126356
126418
  return false;
126357
126419
  }
126420
+ function isStringAndEmptyAnonymousObjectIntersection(type) {
126421
+ if (!type.isIntersection()) {
126422
+ return false;
126423
+ }
126424
+ const { types, checker } = type;
126425
+ return types.length === 2 && types[0].flags & 4 /* String */ && checker.isEmptyAnonymousObjectType(types[1]);
126426
+ }
126358
126427
  function isPunctuation(kind) {
126359
126428
  return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */;
126360
126429
  }
@@ -133399,9 +133468,9 @@ ${lanes.join("\n")}
133399
133468
  "src/services/services.ts"() {
133400
133469
  "use strict";
133401
133470
  init_ts4();
133471
+ init_ts4();
133402
133472
  init_ts_NavigateTo();
133403
133473
  init_ts_NavigationBar();
133404
- init_ts4();
133405
133474
  servicesVersion = "0.8";
133406
133475
  NodeObject = class {
133407
133476
  constructor(kind, pos, end) {
@@ -136407,8 +136476,8 @@ ${lanes.join("\n")}
136407
136476
  var init_addEmptyExportDeclaration = __esm({
136408
136477
  "src/services/codefixes/addEmptyExportDeclaration.ts"() {
136409
136478
  "use strict";
136410
- init_ts_codefix();
136411
136479
  init_ts4();
136480
+ init_ts_codefix();
136412
136481
  registerCodeFix({
136413
136482
  errorCodes: [
136414
136483
  Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code,
@@ -138772,8 +138841,8 @@ ${lanes.join("\n")}
138772
138841
  var init_convertToEsModule = __esm({
138773
138842
  "src/services/codefixes/convertToEsModule.ts"() {
138774
138843
  "use strict";
138775
- init_ts_codefix();
138776
138844
  init_ts4();
138845
+ init_ts_codefix();
138777
138846
  registerCodeFix({
138778
138847
  errorCodes: [Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module.code],
138779
138848
  getCodeActions(context) {
@@ -142372,8 +142441,8 @@ ${lanes.join("\n")}
142372
142441
  var init_fixModuleAndTargetOptions = __esm({
142373
142442
  "src/services/codefixes/fixModuleAndTargetOptions.ts"() {
142374
142443
  "use strict";
142375
- init_ts_codefix();
142376
142444
  init_ts4();
142445
+ init_ts_codefix();
142377
142446
  registerCodeFix({
142378
142447
  errorCodes: [
142379
142448
  Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
@@ -147251,7 +147320,7 @@ ${lanes.join("\n")}
147251
147320
  let useBraces2 = preferences.jsxAttributeCompletionStyle === "braces";
147252
147321
  const type = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
147253
147322
  if (preferences.jsxAttributeCompletionStyle === "auto" && !(type.flags & 528 /* BooleanLike */) && !(type.flags & 1048576 /* Union */ && find(type.types, (type2) => !!(type2.flags & 528 /* BooleanLike */)))) {
147254
- if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)))) {
147323
+ if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */) || isStringAndEmptyAnonymousObjectIntersection(type2)))) {
147255
147324
  insertText = `${escapeSnippetText(name)}=${quote(sourceFile, preferences, "$1")}`;
147256
147325
  isSnippet = true;
147257
147326
  } else {
@@ -147705,7 +147774,7 @@ ${lanes.join("\n")}
147705
147774
  }
147706
147775
  function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
147707
147776
  const replacementSpan = importStatementCompletion.replacementSpan;
147708
- const quotedModuleSpecifier = quote(sourceFile, preferences, origin.moduleSpecifier);
147777
+ const quotedModuleSpecifier = quote(sourceFile, preferences, escapeSnippetText(origin.moduleSpecifier));
147709
147778
  const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
147710
147779
  const tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
147711
147780
  const importKind = ts_codefix_exports.getImportKind(
@@ -148287,7 +148356,7 @@ ${lanes.join("\n")}
148287
148356
  break;
148288
148357
  case 291 /* JsxExpression */:
148289
148358
  case 290 /* JsxSpreadAttribute */:
148290
- if (previousToken.kind === 19 /* CloseBraceToken */ || (previousToken.kind === 79 /* Identifier */ || previousToken.parent.kind === 288 /* JsxAttribute */)) {
148359
+ if (previousToken.kind === 19 /* CloseBraceToken */ || previousToken.kind === 79 /* Identifier */ && previousToken.parent.kind === 288 /* JsxAttribute */) {
148291
148360
  isJsxIdentifierExpected = true;
148292
148361
  }
148293
148362
  break;
@@ -157705,6 +157774,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
157705
157774
  if (isExpression(body)) {
157706
157775
  const returnStatement = factory.createReturnStatement(body);
157707
157776
  const file = body.getSourceFile();
157777
+ setTextRange(returnStatement, body);
157708
157778
  suppressLeadingAndTrailingTrivia(returnStatement);
157709
157779
  copyTrailingAsLeadingComments(
157710
157780
  body,
@@ -164683,8 +164753,8 @@ ${options.prefix}` : "\n" : options.prefix
164683
164753
  var init_rules = __esm({
164684
164754
  "src/services/formatting/rules.ts"() {
164685
164755
  "use strict";
164686
- init_ts_formatting();
164687
164756
  init_ts4();
164757
+ init_ts_formatting();
164688
164758
  }
164689
164759
  });
164690
164760
 
@@ -167096,8 +167166,8 @@ ${options.prefix}` : "\n" : options.prefix
167096
167166
  var init_scriptInfo = __esm({
167097
167167
  "src/server/scriptInfo.ts"() {
167098
167168
  "use strict";
167099
- init_ts_server2();
167100
167169
  init_ts6();
167170
+ init_ts_server2();
167101
167171
  TextStorage = class {
167102
167172
  constructor(host, info, initialVersion) {
167103
167173
  this.host = host;
@@ -167787,8 +167857,8 @@ ${options.prefix}` : "\n" : options.prefix
167787
167857
  "src/server/project.ts"() {
167788
167858
  "use strict";
167789
167859
  init_ts6();
167790
- init_ts_server2();
167791
167860
  init_ts6();
167861
+ init_ts_server2();
167792
167862
  ProjectKind = /* @__PURE__ */ ((ProjectKind2) => {
167793
167863
  ProjectKind2[ProjectKind2["Inferred"] = 0] = "Inferred";
167794
167864
  ProjectKind2[ProjectKind2["Configured"] = 1] = "Configured";
@@ -170128,8 +170198,8 @@ ${options.prefix}` : "\n" : options.prefix
170128
170198
  var init_editorServices = __esm({
170129
170199
  "src/server/editorServices.ts"() {
170130
170200
  "use strict";
170131
- init_ts_server2();
170132
170201
  init_ts6();
170202
+ init_ts_server2();
170133
170203
  maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
170134
170204
  maxFileSize = 4 * 1024 * 1024;
170135
170205
  ProjectsUpdatedInBackgroundEvent = "projectsUpdatedInBackground";
@@ -179097,6 +179167,7 @@ ${e.message}`;
179097
179167
  isString: () => isString,
179098
179168
  isStringAKeyword: () => isStringAKeyword,
179099
179169
  isStringANonContextualKeyword: () => isStringANonContextualKeyword,
179170
+ isStringAndEmptyAnonymousObjectIntersection: () => isStringAndEmptyAnonymousObjectIntersection,
179100
179171
  isStringDoubleQuoted: () => isStringDoubleQuoted,
179101
179172
  isStringLiteral: () => isStringLiteral,
179102
179173
  isStringLiteralLike: () => isStringLiteralLike,
@@ -181454,6 +181525,7 @@ ${e.message}`;
181454
181525
  isString: () => isString,
181455
181526
  isStringAKeyword: () => isStringAKeyword,
181456
181527
  isStringANonContextualKeyword: () => isStringANonContextualKeyword,
181528
+ isStringAndEmptyAnonymousObjectIntersection: () => isStringAndEmptyAnonymousObjectIntersection,
181457
181529
  isStringDoubleQuoted: () => isStringDoubleQuoted,
181458
181530
  isStringLiteral: () => isStringLiteral,
181459
181531
  isStringLiteralLike: () => isStringLiteralLike,