@typescript-deploys/pr-build 5.0.0-pr-52617-10 → 5.0.0-pr-52282-27

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;
@@ -42112,6 +42122,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
42112
42122
  SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
42113
42123
  SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
42114
42124
  SignatureCheckMode3[SignatureCheckMode3["StrictArity"] = 8] = "StrictArity";
42125
+ SignatureCheckMode3[SignatureCheckMode3["StrictTopSignature"] = 16] = "StrictTopSignature";
42115
42126
  SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
42116
42127
  return SignatureCheckMode3;
42117
42128
  })(SignatureCheckMode || {});
@@ -47516,7 +47527,7 @@ function createTypeChecker(host) {
47516
47527
  if (signature.thisParameter) {
47517
47528
  return symbolToParameterDeclaration(signature.thisParameter, context);
47518
47529
  }
47519
- if (signature.declaration) {
47530
+ if (signature.declaration && isInJSFile(signature.declaration)) {
47520
47531
  const thisTag = getJSDocThisTag(signature.declaration);
47521
47532
  if (thisTag && thisTag.typeExpression) {
47522
47533
  return factory.createParameterDeclaration(
@@ -50497,7 +50508,7 @@ function createTypeChecker(host) {
50497
50508
  function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
50498
50509
  const container = getAssignedExpandoInitializer(symbol.valueDeclaration);
50499
50510
  if (container) {
50500
- const tag = getJSDocTypeTag(container);
50511
+ const tag = isInJSFile(container) ? getJSDocTypeTag(container) : void 0;
50501
50512
  if (tag && tag.typeExpression) {
50502
50513
  return getTypeFromTypeNode(tag.typeExpression);
50503
50514
  }
@@ -58219,16 +58230,24 @@ function createTypeChecker(host) {
58219
58230
  void 0
58220
58231
  ) !== 0 /* False */;
58221
58232
  }
58222
- function isAnySignature(s) {
58223
- return !s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s) && (getTypeOfParameter(s.parameters[0]) === anyArrayType || isTypeAny(getTypeOfParameter(s.parameters[0]))) && isTypeAny(getReturnTypeOfSignature(s));
58233
+ function isTopSignature(s) {
58234
+ if (!s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s)) {
58235
+ const paramType = getTypeOfParameter(s.parameters[0]);
58236
+ const restType = isArrayType(paramType) ? getTypeArguments(paramType)[0] : paramType;
58237
+ return !!(restType.flags & (1 /* Any */ | 131072 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */);
58238
+ }
58239
+ return false;
58224
58240
  }
58225
58241
  function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
58226
58242
  if (source === target) {
58227
58243
  return -1 /* True */;
58228
58244
  }
58229
- if (isAnySignature(target)) {
58245
+ if (!(checkMode & 16 /* StrictTopSignature */ && isTopSignature(source)) && isTopSignature(target)) {
58230
58246
  return -1 /* True */;
58231
58247
  }
58248
+ if (checkMode & 16 /* StrictTopSignature */ && isTopSignature(source) && !isTopSignature(target)) {
58249
+ return 0 /* False */;
58250
+ }
58232
58251
  const targetCount = getParameterCount(target);
58233
58252
  const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
58234
58253
  if (sourceHasMoreParameters) {
@@ -58446,7 +58465,9 @@ function createTypeChecker(host) {
58446
58465
  function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
58447
58466
  const s = source.flags;
58448
58467
  const t = target.flags;
58449
- if (t & 3 /* AnyOrUnknown */ || s & 131072 /* Never */ || source === wildcardType)
58468
+ if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
58469
+ return true;
58470
+ if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
58450
58471
  return true;
58451
58472
  if (t & 131072 /* Never */)
58452
58473
  return false;
@@ -60686,10 +60707,11 @@ function createTypeChecker(host) {
60686
60707
  return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
60687
60708
  }
60688
60709
  function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
60710
+ const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
60689
60711
  return compareSignaturesRelated(
60690
60712
  erase ? getErasedSignature(source2) : source2,
60691
60713
  erase ? getErasedSignature(target2) : target2,
60692
- relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0,
60714
+ checkMode,
60693
60715
  reportErrors2,
60694
60716
  reportError,
60695
60717
  incompatibleReporter,
@@ -60814,7 +60836,7 @@ function createTypeChecker(host) {
60814
60836
  if (sourceInfo) {
60815
60837
  return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
60816
60838
  }
60817
- if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
60839
+ if (!(intersectionState & 1 /* Source */) && (relation !== strictSubtypeRelation || getObjectFlags(source2) & 8192 /* FreshLiteral */) && isObjectTypeWithInferableIndex(source2)) {
60818
60840
  return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
60819
60841
  }
60820
60842
  if (reportErrors2) {
@@ -61333,8 +61355,7 @@ function createTypeChecker(host) {
61333
61355
  return !!elementType && isEmptyLiteralType(elementType);
61334
61356
  }
61335
61357
  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 */));
61358
+ return isTupleType(type) || !!getPropertyOfType(type, "0");
61338
61359
  }
61339
61360
  function isArrayOrTupleLikeType(type) {
61340
61361
  return isArrayLikeType(type) || isTupleLikeType(type);
@@ -64673,52 +64694,58 @@ function createTypeChecker(host) {
64673
64694
  if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
64674
64695
  return type;
64675
64696
  }
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)) {
64697
+ const instanceType = mapType(rightType, getInstanceType);
64698
+ if (isTypeAny(type) && (instanceType === globalObjectType || instanceType === globalFunctionType) || !assumeTrue && !(instanceType.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(instanceType))) {
64685
64699
  return type;
64686
64700
  }
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
64701
  return getNarrowedType(
64697
64702
  type,
64698
- targetType,
64703
+ instanceType,
64699
64704
  assumeTrue,
64700
64705
  /*checkDerived*/
64701
64706
  true
64702
64707
  );
64703
64708
  }
64709
+ function getInstanceType(constructorType) {
64710
+ const prototypePropertyType = getTypeOfPropertyOfType(constructorType, "prototype");
64711
+ if (prototypePropertyType && !isTypeAny(prototypePropertyType)) {
64712
+ return prototypePropertyType;
64713
+ }
64714
+ const constructSignatures = getSignaturesOfType(constructorType, 1 /* Construct */);
64715
+ if (constructSignatures.length) {
64716
+ return getUnionType(map(constructSignatures, (signature) => getReturnTypeOfSignature(getErasedSignature(signature))));
64717
+ }
64718
+ return emptyObjectType;
64719
+ }
64704
64720
  function getNarrowedType(type, candidate, assumeTrue, checkDerived) {
64705
64721
  var _a3;
64706
64722
  const key2 = type.flags & 1048576 /* Union */ ? `N${getTypeId(type)},${getTypeId(candidate)},${(assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)}` : void 0;
64707
64723
  return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
64708
64724
  }
64709
64725
  function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
64710
- const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
64711
64726
  if (!assumeTrue) {
64712
- return filterType(type, (t) => !isRelated(t, candidate));
64727
+ if (checkDerived) {
64728
+ return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
64729
+ }
64730
+ const trueType2 = getNarrowedType(
64731
+ type,
64732
+ candidate,
64733
+ /*assumeTrue*/
64734
+ true,
64735
+ /*checkDerived*/
64736
+ false
64737
+ );
64738
+ return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
64713
64739
  }
64714
64740
  if (type.flags & 3 /* AnyOrUnknown */) {
64715
64741
  return candidate;
64716
64742
  }
64743
+ const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
64717
64744
  const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
64718
64745
  const narrowedType = mapType(candidate, (c) => {
64719
64746
  const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
64720
64747
  const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
64721
- const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
64748
+ const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) && !isTypeIdenticalTo(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
64722
64749
  return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
64723
64750
  });
64724
64751
  return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
@@ -72474,7 +72501,7 @@ function createTypeChecker(host) {
72474
72501
  return leftType;
72475
72502
  } else {
72476
72503
  checkAssignmentOperator(rightType);
72477
- return getRegularTypeOfObjectLiteral(rightType);
72504
+ return rightType;
72478
72505
  }
72479
72506
  case 27 /* CommaToken */:
72480
72507
  if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
@@ -111973,14 +112000,14 @@ var moduleResolutionNameAndModeGetter = {
111973
112000
  function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
111974
112001
  return {
111975
112002
  nameAndMode: moduleResolutionNameAndModeGetter,
111976
- resolve: (moduleName, resoluionMode) => resolveModuleName(
112003
+ resolve: (moduleName, resolutionMode) => resolveModuleName(
111977
112004
  moduleName,
111978
112005
  containingFile,
111979
112006
  options,
111980
112007
  host,
111981
112008
  cache,
111982
112009
  redirectedReference,
111983
- resoluionMode
112010
+ resolutionMode
111984
112011
  )
111985
112012
  };
111986
112013
  }