@typescript-deploys/pr-build 5.0.0-pr-52617-10 → 5.0.0-pr-52632-9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -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-insiders.20230205`;
26
+ var version = `${versionMajorMinor}.0-insiders.20230207`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -7272,6 +7272,10 @@ var Diagnostics = {
7272
7272
  Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports: diag(6410, 3 /* Message */, "Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports_6410", "Conditions to set in addition to the resolver-specific defaults when resolving imports."),
7273
7273
  true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false: diag(6411, 3 /* Message */, "true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false_6411", "`true` when 'moduleResolution' is 'node16', 'nodenext', or 'bundler'; otherwise `false`."),
7274
7274
  Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more: diag(6412, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_6412", "Project '{0}' is out of date because buildinfo file '{1}' indicates that file '{2}' was root file of compilation but not any more."),
7275
+ Entering_conditional_exports: diag(6413, 3 /* Message */, "Entering_conditional_exports_6413", "Entering conditional exports."),
7276
+ Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."),
7277
+ Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."),
7278
+ Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
7275
7279
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
7276
7280
  The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
7277
7281
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -37788,18 +37792,24 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
37788
37792
  )));
37789
37793
  } else if (typeof target === "object" && target !== null) {
37790
37794
  if (!Array.isArray(target)) {
37795
+ traceIfEnabled(state, Diagnostics.Entering_conditional_exports);
37791
37796
  for (const condition of getOwnKeys(target)) {
37792
37797
  if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) {
37793
37798
  traceIfEnabled(state, Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
37794
37799
  const subTarget = target[condition];
37795
37800
  const result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
37796
37801
  if (result) {
37802
+ traceIfEnabled(state, Diagnostics.Resolved_under_condition_0, condition);
37803
+ traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
37797
37804
  return result;
37805
+ } else {
37806
+ traceIfEnabled(state, Diagnostics.Failed_to_resolve_under_condition_0, condition);
37798
37807
  }
37799
37808
  } else {
37800
37809
  traceIfEnabled(state, Diagnostics.Saw_non_matching_condition_0, condition);
37801
37810
  }
37802
37811
  }
37812
+ traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
37803
37813
  return void 0;
37804
37814
  } else {
37805
37815
  if (!length(target)) {
@@ -41429,7 +41439,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
41429
41439
  let redirectPathsSpecifiers;
41430
41440
  let relativeSpecifiers;
41431
41441
  for (const modulePath of modulePaths) {
41432
- const specifier = tryGetModuleNameAsNodeModule(
41442
+ const specifier = modulePath.isInNodeModules ? tryGetModuleNameAsNodeModule(
41433
41443
  modulePath,
41434
41444
  info,
41435
41445
  importingSourceFile,
@@ -41439,7 +41449,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
41439
41449
  /*packageNameOnly*/
41440
41450
  void 0,
41441
41451
  options.overrideImportMode
41442
- );
41452
+ ) : void 0;
41443
41453
  nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
41444
41454
  if (specifier && modulePath.isRedirect) {
41445
41455
  return nodeModulesSpecifiers;
@@ -47516,7 +47526,7 @@ function createTypeChecker(host) {
47516
47526
  if (signature.thisParameter) {
47517
47527
  return symbolToParameterDeclaration(signature.thisParameter, context);
47518
47528
  }
47519
- if (signature.declaration) {
47529
+ if (signature.declaration && isInJSFile(signature.declaration)) {
47520
47530
  const thisTag = getJSDocThisTag(signature.declaration);
47521
47531
  if (thisTag && thisTag.typeExpression) {
47522
47532
  return factory.createParameterDeclaration(
@@ -50497,7 +50507,7 @@ function createTypeChecker(host) {
50497
50507
  function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
50498
50508
  const container = getAssignedExpandoInitializer(symbol.valueDeclaration);
50499
50509
  if (container) {
50500
- const tag = getJSDocTypeTag(container);
50510
+ const tag = isInJSFile(container) ? getJSDocTypeTag(container) : void 0;
50501
50511
  if (tag && tag.typeExpression) {
50502
50512
  return getTypeFromTypeNode(tag.typeExpression);
50503
50513
  }
@@ -61333,8 +61343,7 @@ function createTypeChecker(host) {
61333
61343
  return !!elementType && isEmptyLiteralType(elementType);
61334
61344
  }
61335
61345
  function isTupleLikeType(type) {
61336
- let lengthType;
61337
- return isTupleType(type) || !!getPropertyOfType(type, "0") || isArrayLikeType(type) && !!(lengthType = getTypeOfPropertyOfType(type, "length")) && everyType(lengthType, (t) => !!(t.flags & 256 /* NumberLiteral */));
61346
+ return isTupleType(type) || !!getPropertyOfType(type, "0");
61338
61347
  }
61339
61348
  function isArrayOrTupleLikeType(type) {
61340
61349
  return isArrayLikeType(type) || isTupleLikeType(type);
@@ -61345,7 +61354,17 @@ function createTypeChecker(host) {
61345
61354
  return propType;
61346
61355
  }
61347
61356
  if (everyType(type, isTupleType)) {
61348
- return mapType(type, (t) => getRestTypeOfTupleType(t) || undefinedType);
61357
+ return mapType(type, (t) => {
61358
+ const tupleType = t;
61359
+ const restType = getRestTypeOfTupleType(tupleType);
61360
+ if (!restType) {
61361
+ return undefinedType;
61362
+ }
61363
+ if (compilerOptions.noUncheckedIndexedAccess && index >= tupleType.target.fixedLength + getEndElementCount(tupleType.target, 3 /* Fixed */)) {
61364
+ return getUnionType([restType, undefinedType]);
61365
+ }
61366
+ return restType;
61367
+ });
61349
61368
  }
61350
61369
  return void 0;
61351
61370
  }
@@ -62520,7 +62539,13 @@ function createTypeChecker(host) {
62520
62539
  return true;
62521
62540
  }
62522
62541
  if (constraintType.flags & 262144 /* TypeParameter */) {
62523
- inferWithPriority(getIndexType(source), constraintType, 32 /* MappedTypeConstraint */);
62542
+ inferWithPriority(getIndexType(
62543
+ source,
62544
+ /*stringsOnly*/
62545
+ void 0,
62546
+ /*noIndexSignatures*/
62547
+ !!source.pattern
62548
+ ), constraintType, 32 /* MappedTypeConstraint */);
62524
62549
  const extendedConstraint = getConstraintOfType(constraintType);
62525
62550
  if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) {
62526
62551
  return true;
@@ -63987,7 +64012,7 @@ function createTypeChecker(host) {
63987
64012
  }
63988
64013
  return declaredType;
63989
64014
  }
63990
- if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
64015
+ if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && (isMatchingReference(reference, node.parent.parent.expression) || optionalChainContainsReference(node.parent.parent.expression, reference))) {
63991
64016
  return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))));
63992
64017
  }
63993
64018
  return void 0;
@@ -64673,34 +64698,29 @@ function createTypeChecker(host) {
64673
64698
  if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
64674
64699
  return type;
64675
64700
  }
64676
- let targetType;
64677
- const prototypeProperty = getPropertyOfType(rightType, "prototype");
64678
- if (prototypeProperty) {
64679
- const prototypePropertyType = getTypeOfSymbol(prototypeProperty);
64680
- if (!isTypeAny(prototypePropertyType)) {
64681
- targetType = prototypePropertyType;
64682
- }
64683
- }
64684
- if (isTypeAny(type) && (targetType === globalObjectType || targetType === globalFunctionType)) {
64701
+ const instanceType = mapType(rightType, getInstanceType);
64702
+ if (isTypeAny(type) && (instanceType === globalObjectType || instanceType === globalFunctionType) || !assumeTrue && !(instanceType.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(instanceType))) {
64685
64703
  return type;
64686
64704
  }
64687
- if (!targetType) {
64688
- const constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);
64689
- targetType = constructSignatures.length ? getUnionType(map(constructSignatures, (signature) => getReturnTypeOfSignature(getErasedSignature(signature)))) : emptyObjectType;
64690
- }
64691
- if (!assumeTrue && rightType.flags & 1048576 /* Union */) {
64692
- const nonConstructorTypeInUnion = find(rightType.types, (t) => !isConstructorType(t));
64693
- if (!nonConstructorTypeInUnion)
64694
- return type;
64695
- }
64696
64705
  return getNarrowedType(
64697
64706
  type,
64698
- targetType,
64707
+ instanceType,
64699
64708
  assumeTrue,
64700
64709
  /*checkDerived*/
64701
64710
  true
64702
64711
  );
64703
64712
  }
64713
+ function getInstanceType(constructorType) {
64714
+ const prototypePropertyType = getTypeOfPropertyOfType(constructorType, "prototype");
64715
+ if (prototypePropertyType && !isTypeAny(prototypePropertyType)) {
64716
+ return prototypePropertyType;
64717
+ }
64718
+ const constructSignatures = getSignaturesOfType(constructorType, 1 /* Construct */);
64719
+ if (constructSignatures.length) {
64720
+ return getUnionType(map(constructSignatures, (signature) => getReturnTypeOfSignature(getErasedSignature(signature))));
64721
+ }
64722
+ return emptyObjectType;
64723
+ }
64704
64724
  function getNarrowedType(type, candidate, assumeTrue, checkDerived) {
64705
64725
  var _a3;
64706
64726
  const key2 = type.flags & 1048576 /* Union */ ? `N${getTypeId(type)},${getTypeId(candidate)},${(assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)}` : void 0;
@@ -100422,6 +100442,9 @@ function transformModule(context) {
100422
100442
  return visitEachChild(node, visitor, context);
100423
100443
  }
100424
100444
  function visitImportCallExpression(node) {
100445
+ if (moduleKind === 0 /* None */ && languageVersion >= 7 /* ES2020 */) {
100446
+ return visitEachChild(node, visitor, context);
100447
+ }
100425
100448
  const externalModuleName = getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions);
100426
100449
  const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor, isExpression);
100427
100450
  const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
@@ -111973,14 +111996,14 @@ var moduleResolutionNameAndModeGetter = {
111973
111996
  function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
111974
111997
  return {
111975
111998
  nameAndMode: moduleResolutionNameAndModeGetter,
111976
- resolve: (moduleName, resoluionMode) => resolveModuleName(
111999
+ resolve: (moduleName, resolutionMode) => resolveModuleName(
111977
112000
  moduleName,
111978
112001
  containingFile,
111979
112002
  options,
111980
112003
  host,
111981
112004
  cache,
111982
112005
  redirectedReference,
111983
- resoluionMode
112006
+ resolutionMode
111984
112007
  )
111985
112008
  };
111986
112009
  }
package/lib/tsserver.js CHANGED
@@ -1858,6 +1858,7 @@ __export(server_exports, {
1858
1858
  mutateMapSkippingNewValues: () => mutateMapSkippingNewValues,
1859
1859
  needsParentheses: () => needsParentheses,
1860
1860
  needsScopeMarker: () => needsScopeMarker,
1861
+ newCaseClauseTracker: () => newCaseClauseTracker,
1861
1862
  newPrivateEnvironment: () => newPrivateEnvironment,
1862
1863
  noEmitNotification: () => noEmitNotification,
1863
1864
  noEmitSubstitution: () => noEmitSubstitution,
@@ -2286,7 +2287,7 @@ module.exports = __toCommonJS(server_exports);
2286
2287
 
2287
2288
  // src/compiler/corePublic.ts
2288
2289
  var versionMajorMinor = "5.0";
2289
- var version = `${versionMajorMinor}.0-insiders.20230205`;
2290
+ var version = `${versionMajorMinor}.0-insiders.20230207`;
2290
2291
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2291
2292
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2292
2293
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -10735,6 +10736,10 @@ var Diagnostics = {
10735
10736
  Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports: diag(6410, 3 /* Message */, "Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports_6410", "Conditions to set in addition to the resolver-specific defaults when resolving imports."),
10736
10737
  true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false: diag(6411, 3 /* Message */, "true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false_6411", "`true` when 'moduleResolution' is 'node16', 'nodenext', or 'bundler'; otherwise `false`."),
10737
10738
  Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more: diag(6412, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_6412", "Project '{0}' is out of date because buildinfo file '{1}' indicates that file '{2}' was root file of compilation but not any more."),
10739
+ Entering_conditional_exports: diag(6413, 3 /* Message */, "Entering_conditional_exports_6413", "Entering conditional exports."),
10740
+ Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."),
10741
+ Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."),
10742
+ Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
10738
10743
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
10739
10744
  The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
10740
10745
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -42297,18 +42302,24 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
42297
42302
  )));
42298
42303
  } else if (typeof target === "object" && target !== null) {
42299
42304
  if (!Array.isArray(target)) {
42305
+ traceIfEnabled(state, Diagnostics.Entering_conditional_exports);
42300
42306
  for (const condition of getOwnKeys(target)) {
42301
42307
  if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) {
42302
42308
  traceIfEnabled(state, Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
42303
42309
  const subTarget = target[condition];
42304
42310
  const result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
42305
42311
  if (result) {
42312
+ traceIfEnabled(state, Diagnostics.Resolved_under_condition_0, condition);
42313
+ traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
42306
42314
  return result;
42315
+ } else {
42316
+ traceIfEnabled(state, Diagnostics.Failed_to_resolve_under_condition_0, condition);
42307
42317
  }
42308
42318
  } else {
42309
42319
  traceIfEnabled(state, Diagnostics.Saw_non_matching_condition_0, condition);
42310
42320
  }
42311
42321
  }
42322
+ traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
42312
42323
  return void 0;
42313
42324
  } else {
42314
42325
  if (!length(target)) {
@@ -45992,7 +46003,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
45992
46003
  let redirectPathsSpecifiers;
45993
46004
  let relativeSpecifiers;
45994
46005
  for (const modulePath of modulePaths) {
45995
- const specifier = tryGetModuleNameAsNodeModule(
46006
+ const specifier = modulePath.isInNodeModules ? tryGetModuleNameAsNodeModule(
45996
46007
  modulePath,
45997
46008
  info,
45998
46009
  importingSourceFile,
@@ -46002,7 +46013,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
46002
46013
  /*packageNameOnly*/
46003
46014
  void 0,
46004
46015
  options.overrideImportMode
46005
- );
46016
+ ) : void 0;
46006
46017
  nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
46007
46018
  if (specifier && modulePath.isRedirect) {
46008
46019
  return nodeModulesSpecifiers;
@@ -52079,7 +52090,7 @@ function createTypeChecker(host) {
52079
52090
  if (signature.thisParameter) {
52080
52091
  return symbolToParameterDeclaration(signature.thisParameter, context);
52081
52092
  }
52082
- if (signature.declaration) {
52093
+ if (signature.declaration && isInJSFile(signature.declaration)) {
52083
52094
  const thisTag = getJSDocThisTag(signature.declaration);
52084
52095
  if (thisTag && thisTag.typeExpression) {
52085
52096
  return factory.createParameterDeclaration(
@@ -55060,7 +55071,7 @@ function createTypeChecker(host) {
55060
55071
  function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
55061
55072
  const container = getAssignedExpandoInitializer(symbol.valueDeclaration);
55062
55073
  if (container) {
55063
- const tag = getJSDocTypeTag(container);
55074
+ const tag = isInJSFile(container) ? getJSDocTypeTag(container) : void 0;
55064
55075
  if (tag && tag.typeExpression) {
55065
55076
  return getTypeFromTypeNode(tag.typeExpression);
55066
55077
  }
@@ -65896,8 +65907,7 @@ function createTypeChecker(host) {
65896
65907
  return !!elementType && isEmptyLiteralType(elementType);
65897
65908
  }
65898
65909
  function isTupleLikeType(type) {
65899
- let lengthType;
65900
- return isTupleType(type) || !!getPropertyOfType(type, "0") || isArrayLikeType(type) && !!(lengthType = getTypeOfPropertyOfType(type, "length")) && everyType(lengthType, (t) => !!(t.flags & 256 /* NumberLiteral */));
65910
+ return isTupleType(type) || !!getPropertyOfType(type, "0");
65901
65911
  }
65902
65912
  function isArrayOrTupleLikeType(type) {
65903
65913
  return isArrayLikeType(type) || isTupleLikeType(type);
@@ -65908,7 +65918,17 @@ function createTypeChecker(host) {
65908
65918
  return propType;
65909
65919
  }
65910
65920
  if (everyType(type, isTupleType)) {
65911
- return mapType(type, (t) => getRestTypeOfTupleType(t) || undefinedType);
65921
+ return mapType(type, (t) => {
65922
+ const tupleType = t;
65923
+ const restType = getRestTypeOfTupleType(tupleType);
65924
+ if (!restType) {
65925
+ return undefinedType;
65926
+ }
65927
+ if (compilerOptions.noUncheckedIndexedAccess && index >= tupleType.target.fixedLength + getEndElementCount(tupleType.target, 3 /* Fixed */)) {
65928
+ return getUnionType([restType, undefinedType]);
65929
+ }
65930
+ return restType;
65931
+ });
65912
65932
  }
65913
65933
  return void 0;
65914
65934
  }
@@ -67083,7 +67103,13 @@ function createTypeChecker(host) {
67083
67103
  return true;
67084
67104
  }
67085
67105
  if (constraintType.flags & 262144 /* TypeParameter */) {
67086
- inferWithPriority(getIndexType(source), constraintType, 32 /* MappedTypeConstraint */);
67106
+ inferWithPriority(getIndexType(
67107
+ source,
67108
+ /*stringsOnly*/
67109
+ void 0,
67110
+ /*noIndexSignatures*/
67111
+ !!source.pattern
67112
+ ), constraintType, 32 /* MappedTypeConstraint */);
67087
67113
  const extendedConstraint = getConstraintOfType(constraintType);
67088
67114
  if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) {
67089
67115
  return true;
@@ -68550,7 +68576,7 @@ function createTypeChecker(host) {
68550
68576
  }
68551
68577
  return declaredType;
68552
68578
  }
68553
- if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
68579
+ if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && (isMatchingReference(reference, node.parent.parent.expression) || optionalChainContainsReference(node.parent.parent.expression, reference))) {
68554
68580
  return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))));
68555
68581
  }
68556
68582
  return void 0;
@@ -69236,34 +69262,29 @@ function createTypeChecker(host) {
69236
69262
  if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
69237
69263
  return type;
69238
69264
  }
69239
- let targetType;
69240
- const prototypeProperty = getPropertyOfType(rightType, "prototype");
69241
- if (prototypeProperty) {
69242
- const prototypePropertyType = getTypeOfSymbol(prototypeProperty);
69243
- if (!isTypeAny(prototypePropertyType)) {
69244
- targetType = prototypePropertyType;
69245
- }
69246
- }
69247
- if (isTypeAny(type) && (targetType === globalObjectType || targetType === globalFunctionType)) {
69265
+ const instanceType = mapType(rightType, getInstanceType);
69266
+ if (isTypeAny(type) && (instanceType === globalObjectType || instanceType === globalFunctionType) || !assumeTrue && !(instanceType.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(instanceType))) {
69248
69267
  return type;
69249
69268
  }
69250
- if (!targetType) {
69251
- const constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);
69252
- targetType = constructSignatures.length ? getUnionType(map(constructSignatures, (signature) => getReturnTypeOfSignature(getErasedSignature(signature)))) : emptyObjectType;
69253
- }
69254
- if (!assumeTrue && rightType.flags & 1048576 /* Union */) {
69255
- const nonConstructorTypeInUnion = find(rightType.types, (t) => !isConstructorType(t));
69256
- if (!nonConstructorTypeInUnion)
69257
- return type;
69258
- }
69259
69269
  return getNarrowedType(
69260
69270
  type,
69261
- targetType,
69271
+ instanceType,
69262
69272
  assumeTrue,
69263
69273
  /*checkDerived*/
69264
69274
  true
69265
69275
  );
69266
69276
  }
69277
+ function getInstanceType(constructorType) {
69278
+ const prototypePropertyType = getTypeOfPropertyOfType(constructorType, "prototype");
69279
+ if (prototypePropertyType && !isTypeAny(prototypePropertyType)) {
69280
+ return prototypePropertyType;
69281
+ }
69282
+ const constructSignatures = getSignaturesOfType(constructorType, 1 /* Construct */);
69283
+ if (constructSignatures.length) {
69284
+ return getUnionType(map(constructSignatures, (signature) => getReturnTypeOfSignature(getErasedSignature(signature))));
69285
+ }
69286
+ return emptyObjectType;
69287
+ }
69267
69288
  function getNarrowedType(type, candidate, assumeTrue, checkDerived) {
69268
69289
  var _a3;
69269
69290
  const key2 = type.flags & 1048576 /* Union */ ? `N${getTypeId(type)},${getTypeId(candidate)},${(assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)}` : void 0;
@@ -105156,6 +105177,9 @@ function transformModule(context) {
105156
105177
  return visitEachChild(node, visitor, context);
105157
105178
  }
105158
105179
  function visitImportCallExpression(node) {
105180
+ if (moduleKind === 0 /* None */ && languageVersion >= 7 /* ES2020 */) {
105181
+ return visitEachChild(node, visitor, context);
105182
+ }
105159
105183
  const externalModuleName = getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions);
105160
105184
  const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor, isExpression);
105161
105185
  const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
@@ -116768,14 +116792,14 @@ var moduleResolutionNameAndModeGetter = {
116768
116792
  function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
116769
116793
  return {
116770
116794
  nameAndMode: moduleResolutionNameAndModeGetter,
116771
- resolve: (moduleName, resoluionMode) => resolveModuleName(
116795
+ resolve: (moduleName, resolutionMode) => resolveModuleName(
116772
116796
  moduleName,
116773
116797
  containingFile,
116774
116798
  options,
116775
116799
  host,
116776
116800
  cache,
116777
116801
  redirectedReference,
116778
- resoluionMode
116802
+ resolutionMode
116779
116803
  )
116780
116804
  };
116781
116805
  }
@@ -129214,7 +129238,13 @@ function createPackageJsonInfo(fileName, host) {
129214
129238
  function createPackageJsonImportFilter(fromFile, preferences, host) {
129215
129239
  const packageJsons = (host.getPackageJsonsVisibleToFile && host.getPackageJsonsVisibleToFile(fromFile.fileName) || getPackageJsonsVisibleToFile(fromFile.fileName, host)).filter((p) => p.parseable);
129216
129240
  let usesNodeCoreModules;
129217
- return { allowsImportingAmbientModule, allowsImportingSourceFile, allowsImportingSpecifier };
129241
+ let ambientModuleCache;
129242
+ let sourceFileCache;
129243
+ return {
129244
+ allowsImportingAmbientModule,
129245
+ allowsImportingSourceFile,
129246
+ allowsImportingSpecifier
129247
+ };
129218
129248
  function moduleSpecifierIsCoveredByPackageJson(specifier) {
129219
129249
  const packageName = getNodeModuleRootSpecifier(specifier);
129220
129250
  for (const packageJson of packageJsons) {
@@ -129228,26 +129258,49 @@ function createPackageJsonImportFilter(fromFile, preferences, host) {
129228
129258
  if (!packageJsons.length || !moduleSymbol.valueDeclaration) {
129229
129259
  return true;
129230
129260
  }
129231
- const declaringSourceFile = moduleSymbol.valueDeclaration.getSourceFile();
129232
- const declaringNodeModuleName = getNodeModulesPackageNameFromFileName(declaringSourceFile.fileName, moduleSpecifierResolutionHost);
129233
- if (typeof declaringNodeModuleName === "undefined") {
129234
- return true;
129261
+ if (!ambientModuleCache) {
129262
+ ambientModuleCache = /* @__PURE__ */ new Map();
129263
+ } else {
129264
+ const cached = ambientModuleCache.get(moduleSymbol);
129265
+ if (cached !== void 0) {
129266
+ return cached;
129267
+ }
129235
129268
  }
129236
129269
  const declaredModuleSpecifier = stripQuotes(moduleSymbol.getName());
129237
129270
  if (isAllowedCoreNodeModulesImport(declaredModuleSpecifier)) {
129271
+ ambientModuleCache.set(moduleSymbol, true);
129272
+ return true;
129273
+ }
129274
+ const declaringSourceFile = moduleSymbol.valueDeclaration.getSourceFile();
129275
+ const declaringNodeModuleName = getNodeModulesPackageNameFromFileName(declaringSourceFile.fileName, moduleSpecifierResolutionHost);
129276
+ if (typeof declaringNodeModuleName === "undefined") {
129277
+ ambientModuleCache.set(moduleSymbol, true);
129238
129278
  return true;
129239
129279
  }
129240
- return moduleSpecifierIsCoveredByPackageJson(declaringNodeModuleName) || moduleSpecifierIsCoveredByPackageJson(declaredModuleSpecifier);
129280
+ const result = moduleSpecifierIsCoveredByPackageJson(declaringNodeModuleName) || moduleSpecifierIsCoveredByPackageJson(declaredModuleSpecifier);
129281
+ ambientModuleCache.set(moduleSymbol, result);
129282
+ return result;
129241
129283
  }
129242
129284
  function allowsImportingSourceFile(sourceFile, moduleSpecifierResolutionHost) {
129243
129285
  if (!packageJsons.length) {
129244
129286
  return true;
129245
129287
  }
129288
+ if (!sourceFileCache) {
129289
+ sourceFileCache = /* @__PURE__ */ new Map();
129290
+ } else {
129291
+ const cached = sourceFileCache.get(sourceFile);
129292
+ if (cached !== void 0) {
129293
+ return cached;
129294
+ }
129295
+ }
129246
129296
  const moduleSpecifier = getNodeModulesPackageNameFromFileName(sourceFile.fileName, moduleSpecifierResolutionHost);
129247
129297
  if (!moduleSpecifier) {
129298
+ sourceFileCache.set(sourceFile, true);
129248
129299
  return true;
129249
129300
  }
129250
- return moduleSpecifierIsCoveredByPackageJson(moduleSpecifier);
129301
+ const result = moduleSpecifierIsCoveredByPackageJson(moduleSpecifier);
129302
+ sourceFileCache.set(sourceFile, result);
129303
+ return result;
129251
129304
  }
129252
129305
  function allowsImportingSpecifier(moduleSpecifier) {
129253
129306
  if (!packageJsons.length || isAllowedCoreNodeModulesImport(moduleSpecifier)) {
@@ -129467,6 +129520,64 @@ function jsxModeNeedsExplicitImport(jsx) {
129467
129520
  function isSourceFileFromLibrary(program, node) {
129468
129521
  return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node);
129469
129522
  }
129523
+ function newCaseClauseTracker(checker, clauses) {
129524
+ const existingStrings = /* @__PURE__ */ new Set();
129525
+ const existingNumbers = /* @__PURE__ */ new Set();
129526
+ const existingBigInts = /* @__PURE__ */ new Set();
129527
+ for (const clause of clauses) {
129528
+ if (!isDefaultClause(clause)) {
129529
+ if (isLiteralExpression(clause.expression)) {
129530
+ const expression = clause.expression;
129531
+ switch (expression.kind) {
129532
+ case 14 /* NoSubstitutionTemplateLiteral */:
129533
+ case 10 /* StringLiteral */:
129534
+ existingStrings.add(expression.text);
129535
+ break;
129536
+ case 8 /* NumericLiteral */:
129537
+ existingNumbers.add(parseInt(expression.text));
129538
+ break;
129539
+ case 9 /* BigIntLiteral */:
129540
+ const parsedBigInt = parseBigInt(endsWith(expression.text, "n") ? expression.text.slice(0, -1) : expression.text);
129541
+ if (parsedBigInt) {
129542
+ existingBigInts.add(pseudoBigIntToString(parsedBigInt));
129543
+ }
129544
+ break;
129545
+ }
129546
+ } else {
129547
+ const symbol = checker.getSymbolAtLocation(clause.expression);
129548
+ if (symbol && symbol.valueDeclaration && isEnumMember(symbol.valueDeclaration)) {
129549
+ const enumValue = checker.getConstantValue(symbol.valueDeclaration);
129550
+ if (enumValue !== void 0) {
129551
+ addValue(enumValue);
129552
+ }
129553
+ }
129554
+ }
129555
+ }
129556
+ }
129557
+ return {
129558
+ addValue,
129559
+ hasValue
129560
+ };
129561
+ function addValue(value) {
129562
+ switch (typeof value) {
129563
+ case "string":
129564
+ existingStrings.add(value);
129565
+ break;
129566
+ case "number":
129567
+ existingNumbers.add(value);
129568
+ }
129569
+ }
129570
+ function hasValue(value) {
129571
+ switch (typeof value) {
129572
+ case "string":
129573
+ return existingStrings.has(value);
129574
+ case "number":
129575
+ return existingNumbers.has(value);
129576
+ case "object":
129577
+ return existingBigInts.has(pseudoBigIntToString(value));
129578
+ }
129579
+ }
129580
+ }
129470
129581
 
129471
129582
  // src/services/exportInfoMap.ts
129472
129583
  var ImportKind = /* @__PURE__ */ ((ImportKind2) => {
@@ -148020,64 +148131,6 @@ function getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, options,
148020
148131
  }
148021
148132
  return void 0;
148022
148133
  }
148023
- function newCaseClauseTracker(checker, clauses) {
148024
- const existingStrings = /* @__PURE__ */ new Set();
148025
- const existingNumbers = /* @__PURE__ */ new Set();
148026
- const existingBigInts = /* @__PURE__ */ new Set();
148027
- for (const clause of clauses) {
148028
- if (!isDefaultClause(clause)) {
148029
- if (isLiteralExpression(clause.expression)) {
148030
- const expression = clause.expression;
148031
- switch (expression.kind) {
148032
- case 14 /* NoSubstitutionTemplateLiteral */:
148033
- case 10 /* StringLiteral */:
148034
- existingStrings.add(expression.text);
148035
- break;
148036
- case 8 /* NumericLiteral */:
148037
- existingNumbers.add(parseInt(expression.text));
148038
- break;
148039
- case 9 /* BigIntLiteral */:
148040
- const parsedBigInt = parseBigInt(endsWith(expression.text, "n") ? expression.text.slice(0, -1) : expression.text);
148041
- if (parsedBigInt) {
148042
- existingBigInts.add(pseudoBigIntToString(parsedBigInt));
148043
- }
148044
- break;
148045
- }
148046
- } else {
148047
- const symbol = checker.getSymbolAtLocation(clause.expression);
148048
- if (symbol && symbol.valueDeclaration && isEnumMember(symbol.valueDeclaration)) {
148049
- const enumValue = checker.getConstantValue(symbol.valueDeclaration);
148050
- if (enumValue !== void 0) {
148051
- addValue(enumValue);
148052
- }
148053
- }
148054
- }
148055
- }
148056
- }
148057
- return {
148058
- addValue,
148059
- hasValue
148060
- };
148061
- function addValue(value) {
148062
- switch (typeof value) {
148063
- case "string":
148064
- existingStrings.add(value);
148065
- break;
148066
- case "number":
148067
- existingNumbers.add(value);
148068
- }
148069
- }
148070
- function hasValue(value) {
148071
- switch (typeof value) {
148072
- case "string":
148073
- return existingStrings.has(value);
148074
- case "number":
148075
- return existingNumbers.has(value);
148076
- case "object":
148077
- return existingBigInts.has(pseudoBigIntToString(value));
148078
- }
148079
- }
148080
- }
148081
148134
  function typeNodeToExpression(typeNode, languageVersion, quotePreference) {
148082
148135
  switch (typeNode.kind) {
148083
148136
  case 180 /* TypeReference */:
@@ -151086,7 +151139,7 @@ function stringLiteralCompletionDetails(name, location, completion, sourceFile,
151086
151139
  return match && createCompletionDetailsForSymbol(match, checker, sourceFile, location, cancellationToken);
151087
151140
  }
151088
151141
  case StringLiteralCompletionKind.Types:
151089
- return find(completion.types, (t) => t.value === name) ? createCompletionDetails(name, "" /* none */, "type" /* typeElement */, [textPart(name)]) : void 0;
151142
+ return find(completion.types, (t) => t.value === name) ? createCompletionDetails(name, "" /* none */, "string" /* string */, [textPart(name)]) : void 0;
151090
151143
  default:
151091
151144
  return Debug.assertNever(completion);
151092
151145
  }
@@ -151194,6 +151247,10 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
151194
151247
  case 275 /* ExportDeclaration */:
151195
151248
  case 280 /* ExternalModuleReference */:
151196
151249
  return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
151250
+ case 292 /* CaseClause */:
151251
+ const tracker = newCaseClauseTracker(typeChecker, node.parent.parent.clauses);
151252
+ const literals = fromContextualType().types.filter((literal) => !tracker.hasValue(literal.value));
151253
+ return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
151197
151254
  default:
151198
151255
  return fromContextualType();
151199
151256
  }
@@ -168749,6 +168806,7 @@ __export(ts_exports3, {
168749
168806
  mutateMapSkippingNewValues: () => mutateMapSkippingNewValues,
168750
168807
  needsParentheses: () => needsParentheses,
168751
168808
  needsScopeMarker: () => needsScopeMarker,
168809
+ newCaseClauseTracker: () => newCaseClauseTracker,
168752
168810
  newPrivateEnvironment: () => newPrivateEnvironment,
168753
168811
  noEmitNotification: () => noEmitNotification,
168754
168812
  noEmitSubstitution: () => noEmitSubstitution,
@@ -176381,6 +176439,10 @@ function getPerProjectReferences(projects, defaultProject, initialLocation, isFo
176381
176439
  continue;
176382
176440
  if (isLocationProjectReferenceRedirect(project, location))
176383
176441
  continue;
176442
+ updateProjectIfDirty(project);
176443
+ if (!project.containsFile(toNormalizedPath(location.fileName))) {
176444
+ continue;
176445
+ }
176384
176446
  const projectResults = searchPosition(project, location);
176385
176447
  resultsMap.set(project, projectResults != null ? projectResults : emptyArray2);
176386
176448
  searchedProjectKeys.add(getProjectKey(project));
@@ -182693,6 +182755,7 @@ start(initializeNodeSystem(), require("os").platform());
182693
182755
  mutateMapSkippingNewValues,
182694
182756
  needsParentheses,
182695
182757
  needsScopeMarker,
182758
+ newCaseClauseTracker,
182696
182759
  newPrivateEnvironment,
182697
182760
  noEmitNotification,
182698
182761
  noEmitSubstitution,