@typescript-deploys/pr-build 5.8.0-pr-60434-6 → 5.9.0-pr-60898-5

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
@@ -17,8 +17,8 @@ and limitations under the License.
17
17
  "use strict";
18
18
 
19
19
  // src/compiler/corePublic.ts
20
- var versionMajorMinor = "5.8";
21
- var version = `${versionMajorMinor}.0-insiders.20250212`;
20
+ var versionMajorMinor = "5.9";
21
+ var version = `${versionMajorMinor}.0-insiders.20250222`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6825,6 +6825,7 @@ var Diagnostics = {
6825
6825
  This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_between_the_projects_output_files_is_not_the_same_as_the_relative_path_between_its_input_files: diag(2878, 1 /* Error */, "This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_b_2878", "This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files."),
6826
6826
  Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found: diag(2879, 1 /* Error */, "Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found_2879", "Using JSX fragments requires fragment factory '{0}' to be in scope, but it could not be found."),
6827
6827
  Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert: diag(2880, 1 /* Error */, "Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert_2880", "Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'."),
6828
+ This_expression_is_never_nullish: diag(2881, 1 /* Error */, "This_expression_is_never_nullish_2881", "This expression is never nullish."),
6828
6829
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
6829
6830
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
6830
6831
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -58572,7 +58573,7 @@ function createTypeChecker(host) {
58572
58573
  let hasThisParameter = false;
58573
58574
  const iife = getImmediatelyInvokedFunctionExpression(declaration);
58574
58575
  const isJSConstructSignature = isJSDocConstructSignature(declaration);
58575
- const isUntypedSignatureInJSFile = !iife && isInJSFile(declaration) && isValueSignatureDeclaration(declaration) && !hasJSDocParameterTags(declaration) && !getJSDocType(declaration);
58576
+ const isUntypedSignatureInJSFile = !iife && isInJSFile(declaration) && isValueSignatureDeclaration(declaration) && !hasJSDocParameterTags(declaration) && !getJSDocType(declaration) && !getContextualSignatureForFunctionLikeDeclaration(declaration);
58576
58577
  if (isUntypedSignatureInJSFile) {
58577
58578
  flags |= 32 /* IsUntypedSignatureInJSFile */;
58578
58579
  }
@@ -67513,7 +67514,7 @@ function createTypeChecker(host) {
67513
67514
  value,
67514
67515
  /*roundTripOnly*/
67515
67516
  false
67516
- ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
67517
+ ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(source, target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
67517
67518
  }
67518
67519
  if (source.flags & 134217728 /* TemplateLiteral */) {
67519
67520
  const texts = source.texts;
@@ -72343,50 +72344,6 @@ function createTypeChecker(host) {
72343
72344
  )
72344
72345
  );
72345
72346
  }
72346
- function discriminateContextualTypeByArrayElements(node, contextualType) {
72347
- const key = `D${getNodeId(node)},${getTypeId(contextualType)}`;
72348
- const cachedType = getCachedType(key);
72349
- if (cachedType) return cachedType;
72350
- const isIndexPropertyLike = (property) => /^[-+]?\d+$/.test(property.escapedName);
72351
- const hasIndexPropertyOutOfRange = (type, length2) => some(getPropertiesOfType(type), (p) => {
72352
- if (p.flags & 16777216 /* Optional */ || !isIndexPropertyLike(p)) return false;
72353
- const index = +p.escapedName;
72354
- return index < 0 || index >= length2;
72355
- });
72356
- const hasIndexPropertyInRange = (type, length2) => some(getPropertiesOfType(type), (p) => {
72357
- if (!isIndexPropertyLike(p)) return false;
72358
- const index = +p.escapedName;
72359
- return index >= 0 || index < length2;
72360
- });
72361
- const elementsLength = node.elements.length;
72362
- const filteredType = filterType(contextualType, (type) => {
72363
- if (isTupleType(type)) {
72364
- return elementsLength >= type.target.minLength && (!!(type.target.combinedFlags & 12 /* Variable */) || elementsLength <= type.target.fixedLength);
72365
- }
72366
- return !hasIndexPropertyOutOfRange(type, elementsLength);
72367
- });
72368
- if (filteredType.flags & 131072 /* Never */) return setCachedType(key, contextualType);
72369
- if (!(filteredType.flags & 1048576 /* Union */)) {
72370
- return setCachedType(
72371
- key,
72372
- isTupleType(filteredType) || hasIndexPropertyInRange(filteredType, elementsLength) ? filteredType : contextualType
72373
- );
72374
- }
72375
- return setCachedType(
72376
- key,
72377
- discriminateTypeByDiscriminableItems(
72378
- filteredType,
72379
- filter(
72380
- map(node.elements, (element, index) => {
72381
- const name = "" + index;
72382
- return isPossiblyDiscriminantValue(element) && isDiscriminantProperty(filteredType, name) ? [() => getContextFreeTypeOfExpression(element), name] : void 0;
72383
- }),
72384
- (discriminator) => !!discriminator
72385
- ),
72386
- isTypeAssignableTo
72387
- )
72388
- );
72389
- }
72390
72347
  function getApparentTypeOfContextualType(node, contextFlags) {
72391
72348
  const contextualType = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType(node, contextFlags);
72392
72349
  const instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
@@ -72401,12 +72358,7 @@ function createTypeChecker(host) {
72401
72358
  /*noReductions*/
72402
72359
  true
72403
72360
  );
72404
- if (apparentType.flags & 1048576 /* Union */) {
72405
- if (isObjectLiteralExpression(node)) return discriminateContextualTypeByObjectMembers(node, apparentType);
72406
- if (isJsxAttributes(node)) return discriminateContextualTypeByJSXAttributes(node, apparentType);
72407
- if (isArrayLiteralExpression(node)) return discriminateContextualTypeByArrayElements(node, apparentType);
72408
- }
72409
- return apparentType;
72361
+ return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
72410
72362
  }
72411
72363
  }
72412
72364
  function instantiateContextualType(contextualType, node, contextFlags) {
@@ -77303,14 +77255,14 @@ function createTypeChecker(host) {
77303
77255
  function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) {
77304
77256
  return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType;
77305
77257
  }
77306
- function inferFromAnnotatedParameters(signature, context, inferenceContext) {
77258
+ function inferFromAnnotatedParametersAndReturn(signature, context, inferenceContext) {
77307
77259
  const len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
77308
77260
  for (let i = 0; i < len; i++) {
77309
77261
  const declaration = signature.parameters[i].valueDeclaration;
77310
- const typeNode = getEffectiveTypeAnnotationNode(declaration);
77311
- if (typeNode) {
77262
+ const typeNode2 = getEffectiveTypeAnnotationNode(declaration);
77263
+ if (typeNode2) {
77312
77264
  const source = addOptionality(
77313
- getTypeFromTypeNode(typeNode),
77265
+ getTypeFromTypeNode(typeNode2),
77314
77266
  /*isProperty*/
77315
77267
  false,
77316
77268
  isOptionalDeclaration(declaration)
@@ -77319,6 +77271,12 @@ function createTypeChecker(host) {
77319
77271
  inferTypes(inferenceContext.inferences, source, target);
77320
77272
  }
77321
77273
  }
77274
+ const typeNode = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
77275
+ if (typeNode) {
77276
+ const source = getTypeFromTypeNode(typeNode);
77277
+ const target = getReturnTypeOfSignature(context);
77278
+ inferTypes(inferenceContext.inferences, source, target);
77279
+ }
77322
77280
  }
77323
77281
  function assignContextualParameterTypes(signature, context) {
77324
77282
  if (context.typeParameters) {
@@ -78012,7 +77970,7 @@ function createTypeChecker(host) {
78012
77970
  const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
78013
77971
  if (trueType2 === initType) return void 0;
78014
77972
  const falseCondition = createFlowNode(64 /* FalseCondition */, expr, antecedent);
78015
- const falseSubtype = getFlowTypeOfReference(param.name, initType, trueType2, func, falseCondition);
77973
+ const falseSubtype = getReducedType(getFlowTypeOfReference(param.name, initType, trueType2, func, falseCondition));
78016
77974
  return falseSubtype.flags & 131072 /* Never */ ? trueType2 : void 0;
78017
77975
  }
78018
77976
  function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
@@ -78107,7 +78065,7 @@ function createTypeChecker(host) {
78107
78065
  const inferenceContext = getInferenceContext(node);
78108
78066
  let instantiatedContextualSignature;
78109
78067
  if (checkMode && checkMode & 2 /* Inferential */) {
78110
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
78068
+ inferFromAnnotatedParametersAndReturn(signature, contextualSignature, inferenceContext);
78111
78069
  const restType = getEffectiveRestType(contextualSignature);
78112
78070
  if (restType && restType.flags & 262144 /* TypeParameter */) {
78113
78071
  instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
@@ -78121,7 +78079,7 @@ function createTypeChecker(host) {
78121
78079
  } else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
78122
78080
  const inferenceContext = getInferenceContext(node);
78123
78081
  if (checkMode && checkMode & 2 /* Inferential */) {
78124
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
78082
+ inferFromAnnotatedParametersAndReturn(signature, contextualSignature, inferenceContext);
78125
78083
  }
78126
78084
  }
78127
78085
  if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
@@ -78884,21 +78842,36 @@ function createTypeChecker(host) {
78884
78842
  if (isBinaryExpression(right) && (right.operatorToken.kind === 57 /* BarBarToken */ || right.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
78885
78843
  grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind));
78886
78844
  }
78887
- const leftTarget = skipOuterExpressions(left, 63 /* All */);
78888
- const nullishSemantics = getSyntacticNullishnessSemantics(leftTarget);
78889
- if (nullishSemantics !== 3 /* Sometimes */) {
78890
- if (node.parent.kind === 226 /* BinaryExpression */) {
78891
- error(leftTarget, Diagnostics.This_binary_expression_is_never_nullish_Are_you_missing_parentheses);
78892
- } else {
78893
- if (nullishSemantics === 1 /* Always */) {
78894
- error(leftTarget, Diagnostics.This_expression_is_always_nullish);
78895
- } else {
78896
- error(leftTarget, Diagnostics.Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish);
78897
- }
78898
- }
78845
+ checkNullishCoalesceOperandLeft(node);
78846
+ checkNullishCoalesceOperandRight(node);
78847
+ }
78848
+ }
78849
+ function checkNullishCoalesceOperandLeft(node) {
78850
+ const leftTarget = skipOuterExpressions(node.left, 63 /* All */);
78851
+ const nullishSemantics = getSyntacticNullishnessSemantics(leftTarget);
78852
+ if (nullishSemantics !== 3 /* Sometimes */) {
78853
+ if (nullishSemantics === 1 /* Always */) {
78854
+ error(leftTarget, Diagnostics.This_expression_is_always_nullish);
78855
+ } else {
78856
+ error(leftTarget, Diagnostics.Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish);
78899
78857
  }
78900
78858
  }
78901
78859
  }
78860
+ function checkNullishCoalesceOperandRight(node) {
78861
+ const rightTarget = skipOuterExpressions(node.right, 63 /* All */);
78862
+ const nullishSemantics = getSyntacticNullishnessSemantics(rightTarget);
78863
+ if (isNotWithinNullishCoalesceExpression(node)) {
78864
+ return;
78865
+ }
78866
+ if (nullishSemantics === 1 /* Always */) {
78867
+ error(rightTarget, Diagnostics.This_expression_is_always_nullish);
78868
+ } else if (nullishSemantics === 2 /* Never */) {
78869
+ error(rightTarget, Diagnostics.This_expression_is_never_nullish);
78870
+ }
78871
+ }
78872
+ function isNotWithinNullishCoalesceExpression(node) {
78873
+ return !isBinaryExpression(node.parent) || node.parent.operatorToken.kind !== 61 /* QuestionQuestionToken */;
78874
+ }
78902
78875
  function getSyntacticNullishnessSemantics(node) {
78903
78876
  node = skipOuterExpressions(node);
78904
78877
  switch (node.kind) {
@@ -84617,7 +84590,7 @@ function createTypeChecker(host) {
84617
84590
  checkGrammarModifiers(node);
84618
84591
  checkCollisionsForDeclarationName(node, node.name);
84619
84592
  checkExportsOnMergedDeclarations(node);
84620
- node.members.forEach(checkEnumMember);
84593
+ node.members.forEach(checkSourceElement);
84621
84594
  if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
84622
84595
  error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
84623
84596
  }
@@ -85112,11 +85085,10 @@ function createTypeChecker(host) {
85112
85085
  return;
85113
85086
  }
85114
85087
  checkGrammarModifiers(node);
85115
- const isImportEquals = isInternalModuleImportEqualsDeclaration(node);
85116
- if (compilerOptions.erasableSyntaxOnly && isImportEquals && !(node.flags & 33554432 /* Ambient */)) {
85088
+ if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
85117
85089
  error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
85118
85090
  }
85119
- if (isImportEquals || checkExternalImportOrExportDeclaration(node)) {
85091
+ if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
85120
85092
  checkImportBinding(node);
85121
85093
  markLinkedReferences(node, 6 /* ExportImportEquals */);
85122
85094
  if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
@@ -85236,6 +85208,9 @@ function createTypeChecker(host) {
85236
85208
  if (checkGrammarModuleElementContext(node, illegalContextMessage)) {
85237
85209
  return;
85238
85210
  }
85211
+ if (compilerOptions.erasableSyntaxOnly && node.isExportEquals && !(node.flags & 33554432 /* Ambient */)) {
85212
+ error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
85213
+ }
85239
85214
  const container = node.parent.kind === 307 /* SourceFile */ ? node.parent : node.parent.parent;
85240
85215
  if (container.kind === 267 /* ModuleDeclaration */ && !isAmbientModule(container)) {
85241
85216
  if (node.isExportEquals) {
@@ -85576,6 +85551,8 @@ function createTypeChecker(host) {
85576
85551
  return checkTypeAliasDeclaration(node);
85577
85552
  case 266 /* EnumDeclaration */:
85578
85553
  return checkEnumDeclaration(node);
85554
+ case 306 /* EnumMember */:
85555
+ return checkEnumMember(node);
85579
85556
  case 267 /* ModuleDeclaration */:
85580
85557
  return checkModuleDeclaration(node);
85581
85558
  case 272 /* ImportDeclaration */:
@@ -3634,7 +3634,7 @@ declare namespace ts {
3634
3634
  readDirectory(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[] | undefined, depth?: number): string[];
3635
3635
  }
3636
3636
  }
3637
- const versionMajorMinor = "5.8";
3637
+ const versionMajorMinor = "5.9";
3638
3638
  /** The version of the TypeScript compiler release */
3639
3639
  const version: string;
3640
3640
  /**
package/lib/typescript.js CHANGED
@@ -2284,8 +2284,8 @@ __export(typescript_exports, {
2284
2284
  module.exports = __toCommonJS(typescript_exports);
2285
2285
 
2286
2286
  // src/compiler/corePublic.ts
2287
- var versionMajorMinor = "5.8";
2288
- var version = `${versionMajorMinor}.0-insiders.20250212`;
2287
+ var versionMajorMinor = "5.9";
2288
+ var version = `${versionMajorMinor}.0-insiders.20250222`;
2289
2289
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2290
2290
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2291
2291
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -10211,6 +10211,7 @@ var Diagnostics = {
10211
10211
  This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_between_the_projects_output_files_is_not_the_same_as_the_relative_path_between_its_input_files: diag(2878, 1 /* Error */, "This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_b_2878", "This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files."),
10212
10212
  Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found: diag(2879, 1 /* Error */, "Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found_2879", "Using JSX fragments requires fragment factory '{0}' to be in scope, but it could not be found."),
10213
10213
  Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert: diag(2880, 1 /* Error */, "Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert_2880", "Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'."),
10214
+ This_expression_is_never_nullish: diag(2881, 1 /* Error */, "This_expression_is_never_nullish_2881", "This expression is never nullish."),
10214
10215
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
10215
10216
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
10216
10217
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -63182,7 +63183,7 @@ function createTypeChecker(host) {
63182
63183
  let hasThisParameter2 = false;
63183
63184
  const iife = getImmediatelyInvokedFunctionExpression(declaration);
63184
63185
  const isJSConstructSignature = isJSDocConstructSignature(declaration);
63185
- const isUntypedSignatureInJSFile = !iife && isInJSFile(declaration) && isValueSignatureDeclaration(declaration) && !hasJSDocParameterTags(declaration) && !getJSDocType(declaration);
63186
+ const isUntypedSignatureInJSFile = !iife && isInJSFile(declaration) && isValueSignatureDeclaration(declaration) && !hasJSDocParameterTags(declaration) && !getJSDocType(declaration) && !getContextualSignatureForFunctionLikeDeclaration(declaration);
63186
63187
  if (isUntypedSignatureInJSFile) {
63187
63188
  flags |= 32 /* IsUntypedSignatureInJSFile */;
63188
63189
  }
@@ -72123,7 +72124,7 @@ function createTypeChecker(host) {
72123
72124
  value,
72124
72125
  /*roundTripOnly*/
72125
72126
  false
72126
- ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
72127
+ ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(source, target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
72127
72128
  }
72128
72129
  if (source.flags & 134217728 /* TemplateLiteral */) {
72129
72130
  const texts = source.texts;
@@ -76953,50 +76954,6 @@ function createTypeChecker(host) {
76953
76954
  )
76954
76955
  );
76955
76956
  }
76956
- function discriminateContextualTypeByArrayElements(node, contextualType) {
76957
- const key = `D${getNodeId(node)},${getTypeId(contextualType)}`;
76958
- const cachedType = getCachedType(key);
76959
- if (cachedType) return cachedType;
76960
- const isIndexPropertyLike = (property) => /^[-+]?\d+$/.test(property.escapedName);
76961
- const hasIndexPropertyOutOfRange = (type, length2) => some(getPropertiesOfType(type), (p) => {
76962
- if (p.flags & 16777216 /* Optional */ || !isIndexPropertyLike(p)) return false;
76963
- const index = +p.escapedName;
76964
- return index < 0 || index >= length2;
76965
- });
76966
- const hasIndexPropertyInRange = (type, length2) => some(getPropertiesOfType(type), (p) => {
76967
- if (!isIndexPropertyLike(p)) return false;
76968
- const index = +p.escapedName;
76969
- return index >= 0 || index < length2;
76970
- });
76971
- const elementsLength = node.elements.length;
76972
- const filteredType = filterType(contextualType, (type) => {
76973
- if (isTupleType(type)) {
76974
- return elementsLength >= type.target.minLength && (!!(type.target.combinedFlags & 12 /* Variable */) || elementsLength <= type.target.fixedLength);
76975
- }
76976
- return !hasIndexPropertyOutOfRange(type, elementsLength);
76977
- });
76978
- if (filteredType.flags & 131072 /* Never */) return setCachedType(key, contextualType);
76979
- if (!(filteredType.flags & 1048576 /* Union */)) {
76980
- return setCachedType(
76981
- key,
76982
- isTupleType(filteredType) || hasIndexPropertyInRange(filteredType, elementsLength) ? filteredType : contextualType
76983
- );
76984
- }
76985
- return setCachedType(
76986
- key,
76987
- discriminateTypeByDiscriminableItems(
76988
- filteredType,
76989
- filter(
76990
- map(node.elements, (element, index) => {
76991
- const name = "" + index;
76992
- return isPossiblyDiscriminantValue(element) && isDiscriminantProperty(filteredType, name) ? [() => getContextFreeTypeOfExpression(element), name] : void 0;
76993
- }),
76994
- (discriminator) => !!discriminator
76995
- ),
76996
- isTypeAssignableTo
76997
- )
76998
- );
76999
- }
77000
76957
  function getApparentTypeOfContextualType(node, contextFlags) {
77001
76958
  const contextualType = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType2(node, contextFlags);
77002
76959
  const instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
@@ -77011,12 +76968,7 @@ function createTypeChecker(host) {
77011
76968
  /*noReductions*/
77012
76969
  true
77013
76970
  );
77014
- if (apparentType.flags & 1048576 /* Union */) {
77015
- if (isObjectLiteralExpression(node)) return discriminateContextualTypeByObjectMembers(node, apparentType);
77016
- if (isJsxAttributes(node)) return discriminateContextualTypeByJSXAttributes(node, apparentType);
77017
- if (isArrayLiteralExpression(node)) return discriminateContextualTypeByArrayElements(node, apparentType);
77018
- }
77019
- return apparentType;
76971
+ return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
77020
76972
  }
77021
76973
  }
77022
76974
  function instantiateContextualType(contextualType, node, contextFlags) {
@@ -81913,14 +81865,14 @@ function createTypeChecker(host) {
81913
81865
  function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) {
81914
81866
  return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType;
81915
81867
  }
81916
- function inferFromAnnotatedParameters(signature, context, inferenceContext) {
81868
+ function inferFromAnnotatedParametersAndReturn(signature, context, inferenceContext) {
81917
81869
  const len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
81918
81870
  for (let i = 0; i < len; i++) {
81919
81871
  const declaration = signature.parameters[i].valueDeclaration;
81920
- const typeNode = getEffectiveTypeAnnotationNode(declaration);
81921
- if (typeNode) {
81872
+ const typeNode2 = getEffectiveTypeAnnotationNode(declaration);
81873
+ if (typeNode2) {
81922
81874
  const source = addOptionality(
81923
- getTypeFromTypeNode(typeNode),
81875
+ getTypeFromTypeNode(typeNode2),
81924
81876
  /*isProperty*/
81925
81877
  false,
81926
81878
  isOptionalDeclaration(declaration)
@@ -81929,6 +81881,12 @@ function createTypeChecker(host) {
81929
81881
  inferTypes(inferenceContext.inferences, source, target);
81930
81882
  }
81931
81883
  }
81884
+ const typeNode = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
81885
+ if (typeNode) {
81886
+ const source = getTypeFromTypeNode(typeNode);
81887
+ const target = getReturnTypeOfSignature(context);
81888
+ inferTypes(inferenceContext.inferences, source, target);
81889
+ }
81932
81890
  }
81933
81891
  function assignContextualParameterTypes(signature, context) {
81934
81892
  if (context.typeParameters) {
@@ -82622,7 +82580,7 @@ function createTypeChecker(host) {
82622
82580
  const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
82623
82581
  if (trueType2 === initType) return void 0;
82624
82582
  const falseCondition = createFlowNode(64 /* FalseCondition */, expr, antecedent);
82625
- const falseSubtype = getFlowTypeOfReference(param.name, initType, trueType2, func, falseCondition);
82583
+ const falseSubtype = getReducedType(getFlowTypeOfReference(param.name, initType, trueType2, func, falseCondition));
82626
82584
  return falseSubtype.flags & 131072 /* Never */ ? trueType2 : void 0;
82627
82585
  }
82628
82586
  function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
@@ -82717,7 +82675,7 @@ function createTypeChecker(host) {
82717
82675
  const inferenceContext = getInferenceContext(node);
82718
82676
  let instantiatedContextualSignature;
82719
82677
  if (checkMode && checkMode & 2 /* Inferential */) {
82720
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
82678
+ inferFromAnnotatedParametersAndReturn(signature, contextualSignature, inferenceContext);
82721
82679
  const restType = getEffectiveRestType(contextualSignature);
82722
82680
  if (restType && restType.flags & 262144 /* TypeParameter */) {
82723
82681
  instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
@@ -82731,7 +82689,7 @@ function createTypeChecker(host) {
82731
82689
  } else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
82732
82690
  const inferenceContext = getInferenceContext(node);
82733
82691
  if (checkMode && checkMode & 2 /* Inferential */) {
82734
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
82692
+ inferFromAnnotatedParametersAndReturn(signature, contextualSignature, inferenceContext);
82735
82693
  }
82736
82694
  }
82737
82695
  if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
@@ -83494,21 +83452,36 @@ function createTypeChecker(host) {
83494
83452
  if (isBinaryExpression(right) && (right.operatorToken.kind === 57 /* BarBarToken */ || right.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
83495
83453
  grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind));
83496
83454
  }
83497
- const leftTarget = skipOuterExpressions(left, 63 /* All */);
83498
- const nullishSemantics = getSyntacticNullishnessSemantics(leftTarget);
83499
- if (nullishSemantics !== 3 /* Sometimes */) {
83500
- if (node.parent.kind === 226 /* BinaryExpression */) {
83501
- error2(leftTarget, Diagnostics.This_binary_expression_is_never_nullish_Are_you_missing_parentheses);
83502
- } else {
83503
- if (nullishSemantics === 1 /* Always */) {
83504
- error2(leftTarget, Diagnostics.This_expression_is_always_nullish);
83505
- } else {
83506
- error2(leftTarget, Diagnostics.Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish);
83507
- }
83508
- }
83455
+ checkNullishCoalesceOperandLeft(node);
83456
+ checkNullishCoalesceOperandRight(node);
83457
+ }
83458
+ }
83459
+ function checkNullishCoalesceOperandLeft(node) {
83460
+ const leftTarget = skipOuterExpressions(node.left, 63 /* All */);
83461
+ const nullishSemantics = getSyntacticNullishnessSemantics(leftTarget);
83462
+ if (nullishSemantics !== 3 /* Sometimes */) {
83463
+ if (nullishSemantics === 1 /* Always */) {
83464
+ error2(leftTarget, Diagnostics.This_expression_is_always_nullish);
83465
+ } else {
83466
+ error2(leftTarget, Diagnostics.Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish);
83509
83467
  }
83510
83468
  }
83511
83469
  }
83470
+ function checkNullishCoalesceOperandRight(node) {
83471
+ const rightTarget = skipOuterExpressions(node.right, 63 /* All */);
83472
+ const nullishSemantics = getSyntacticNullishnessSemantics(rightTarget);
83473
+ if (isNotWithinNullishCoalesceExpression(node)) {
83474
+ return;
83475
+ }
83476
+ if (nullishSemantics === 1 /* Always */) {
83477
+ error2(rightTarget, Diagnostics.This_expression_is_always_nullish);
83478
+ } else if (nullishSemantics === 2 /* Never */) {
83479
+ error2(rightTarget, Diagnostics.This_expression_is_never_nullish);
83480
+ }
83481
+ }
83482
+ function isNotWithinNullishCoalesceExpression(node) {
83483
+ return !isBinaryExpression(node.parent) || node.parent.operatorToken.kind !== 61 /* QuestionQuestionToken */;
83484
+ }
83512
83485
  function getSyntacticNullishnessSemantics(node) {
83513
83486
  node = skipOuterExpressions(node);
83514
83487
  switch (node.kind) {
@@ -89227,7 +89200,7 @@ function createTypeChecker(host) {
89227
89200
  checkGrammarModifiers(node);
89228
89201
  checkCollisionsForDeclarationName(node, node.name);
89229
89202
  checkExportsOnMergedDeclarations(node);
89230
- node.members.forEach(checkEnumMember);
89203
+ node.members.forEach(checkSourceElement);
89231
89204
  if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
89232
89205
  error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
89233
89206
  }
@@ -89722,11 +89695,10 @@ function createTypeChecker(host) {
89722
89695
  return;
89723
89696
  }
89724
89697
  checkGrammarModifiers(node);
89725
- const isImportEquals = isInternalModuleImportEqualsDeclaration(node);
89726
- if (compilerOptions.erasableSyntaxOnly && isImportEquals && !(node.flags & 33554432 /* Ambient */)) {
89698
+ if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
89727
89699
  error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
89728
89700
  }
89729
- if (isImportEquals || checkExternalImportOrExportDeclaration(node)) {
89701
+ if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
89730
89702
  checkImportBinding(node);
89731
89703
  markLinkedReferences(node, 6 /* ExportImportEquals */);
89732
89704
  if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
@@ -89846,6 +89818,9 @@ function createTypeChecker(host) {
89846
89818
  if (checkGrammarModuleElementContext(node, illegalContextMessage)) {
89847
89819
  return;
89848
89820
  }
89821
+ if (compilerOptions.erasableSyntaxOnly && node.isExportEquals && !(node.flags & 33554432 /* Ambient */)) {
89822
+ error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
89823
+ }
89849
89824
  const container = node.parent.kind === 307 /* SourceFile */ ? node.parent : node.parent.parent;
89850
89825
  if (container.kind === 267 /* ModuleDeclaration */ && !isAmbientModule(container)) {
89851
89826
  if (node.isExportEquals) {
@@ -90186,6 +90161,8 @@ function createTypeChecker(host) {
90186
90161
  return checkTypeAliasDeclaration(node);
90187
90162
  case 266 /* EnumDeclaration */:
90188
90163
  return checkEnumDeclaration(node);
90164
+ case 306 /* EnumMember */:
90165
+ return checkEnumMember(node);
90189
90166
  case 267 /* ModuleDeclaration */:
90190
90167
  return checkModuleDeclaration(node);
90191
90168
  case 272 /* ImportDeclaration */:
@@ -144212,6 +144189,7 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
144212
144189
  if (getAllowSyntheticDefaultImports(program.getCompilerOptions())) {
144213
144190
  for (const moduleSpecifier of sourceFile.imports) {
144214
144191
  const importNode = importFromModuleSpecifier(moduleSpecifier);
144192
+ if (isImportEqualsDeclaration(importNode) && hasSyntacticModifier(importNode, 32 /* Export */)) continue;
144215
144193
  const name = importNameForConvertToDefaultImport(importNode);
144216
144194
  if (!name) continue;
144217
144195
  const module2 = (_a = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier, sourceFile)) == null ? void 0 : _a.resolvedModule;
@@ -164437,10 +164415,14 @@ function typeNodeToAutoImportableTypeNode(typeNode, importAdder, scriptTarget) {
164437
164415
  return getSynthesizedDeepClone(typeNode);
164438
164416
  }
164439
164417
  function endOfRequiredTypeParameters(checker, type) {
164418
+ var _a;
164440
164419
  Debug.assert(type.typeArguments);
164441
164420
  const fullTypeArguments = type.typeArguments;
164442
164421
  const target = type.target;
164443
164422
  for (let cutoff = 0; cutoff < fullTypeArguments.length; cutoff++) {
164423
+ if (((_a = target.localTypeParameters) == null ? void 0 : _a[cutoff].constraint) === void 0) {
164424
+ continue;
164425
+ }
164444
164426
  const typeArguments = fullTypeArguments.slice(0, cutoff);
164445
164427
  const filledIn = checker.fillMissingTypeArguments(
164446
164428
  typeArguments,
@@ -170150,6 +170132,17 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
170150
170132
  const existing = new Set(namedImportsOrExports.elements.map((n) => moduleExportNameTextEscaped(n.propertyName || n.name)));
170151
170133
  const uniques = exports2.filter((e) => e.escapedName !== "default" /* Default */ && !existing.has(e.escapedName));
170152
170134
  return { kind: 1 /* Properties */, symbols: uniques, hasIndexSignature: false };
170135
+ case 226 /* BinaryExpression */:
170136
+ if (parent2.operatorToken.kind === 103 /* InKeyword */) {
170137
+ const type = typeChecker.getTypeAtLocation(parent2.right);
170138
+ const properties = type.isUnion() ? typeChecker.getAllPossiblePropertiesOfTypes(type.types) : type.getApparentProperties();
170139
+ return {
170140
+ kind: 1 /* Properties */,
170141
+ symbols: properties.filter((prop) => !prop.valueDeclaration || !isPrivateIdentifierClassElementDeclaration(prop.valueDeclaration)),
170142
+ hasIndexSignature: false
170143
+ };
170144
+ }
170145
+ return fromContextualType(0 /* None */);
170153
170146
  default:
170154
170147
  return fromContextualType() || fromContextualType(0 /* None */);
170155
170148
  }
@@ -173278,8 +173271,8 @@ var Core;
173278
173271
  if (!(symbol2.flags & (32 /* Class */ | 64 /* Interface */)) || !addToSeen(seen, symbol2)) return;
173279
173272
  return firstDefined(symbol2.declarations, (declaration) => firstDefined(getAllSuperTypeNodes(declaration), (typeReference) => {
173280
173273
  const type = checker.getTypeAtLocation(typeReference);
173281
- const propertySymbol = type && type.symbol && checker.getPropertyOfType(type, propertyName);
173282
- return type && propertySymbol && (firstDefined(checker.getRootSymbols(propertySymbol), cb) || recur(type.symbol));
173274
+ const propertySymbol = type.symbol && checker.getPropertyOfType(type, propertyName);
173275
+ return propertySymbol && firstDefined(checker.getRootSymbols(propertySymbol), cb) || type.symbol && recur(type.symbol);
173283
173276
  }));
173284
173277
  }
173285
173278
  }
@@ -181975,6 +181968,11 @@ var SmartIndenter;
181975
181968
  return false;
181976
181969
  }
181977
181970
  break;
181971
+ case 258 /* TryStatement */:
181972
+ if (childKind === 241 /* Block */) {
181973
+ return false;
181974
+ }
181975
+ break;
181978
181976
  }
181979
181977
  return indentByDefault;
181980
181978
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.8.0-pr-60434-6",
5
+ "version": "5.9.0-pr-60898-5",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -40,48 +40,48 @@
40
40
  ],
41
41
  "devDependencies": {
42
42
  "@dprint/formatter": "^0.4.1",
43
- "@dprint/typescript": "0.93.3",
43
+ "@dprint/typescript": "0.93.4",
44
44
  "@esfx/canceltoken": "^1.0.0",
45
- "@eslint/js": "^9.17.0",
46
- "@octokit/rest": "^21.0.2",
45
+ "@eslint/js": "^9.20.0",
46
+ "@octokit/rest": "^21.1.1",
47
47
  "@types/chai": "^4.3.20",
48
- "@types/diff": "^5.2.3",
48
+ "@types/diff": "^7.0.1",
49
49
  "@types/minimist": "^1.2.5",
50
50
  "@types/mocha": "^10.0.10",
51
51
  "@types/ms": "^0.7.34",
52
52
  "@types/node": "latest",
53
53
  "@types/source-map-support": "^0.5.10",
54
54
  "@types/which": "^3.0.4",
55
- "@typescript-eslint/rule-tester": "^8.18.1",
56
- "@typescript-eslint/type-utils": "^8.18.1",
57
- "@typescript-eslint/utils": "^8.18.1",
55
+ "@typescript-eslint/rule-tester": "^8.24.1",
56
+ "@typescript-eslint/type-utils": "^8.24.1",
57
+ "@typescript-eslint/utils": "^8.24.1",
58
58
  "azure-devops-node-api": "^14.1.0",
59
59
  "c8": "^10.1.3",
60
60
  "chai": "^4.5.0",
61
- "chalk": "^4.1.2",
62
- "chokidar": "^3.6.0",
63
- "diff": "^5.2.0",
64
- "dprint": "^0.47.6",
61
+ "chokidar": "^4.0.3",
62
+ "diff": "^7.0.0",
63
+ "dprint": "^0.49.0",
65
64
  "esbuild": "^0.25.0",
66
- "eslint": "^9.17.0",
65
+ "eslint": "^9.20.1",
67
66
  "eslint-formatter-autolinkable-stylish": "^1.4.0",
68
67
  "eslint-plugin-regexp": "^2.7.0",
69
- "fast-xml-parser": "^4.5.1",
68
+ "fast-xml-parser": "^4.5.2",
70
69
  "glob": "^10.4.5",
71
- "globals": "^15.13.0",
70
+ "globals": "^15.15.0",
72
71
  "hereby": "^1.10.0",
73
72
  "jsonc-parser": "^3.3.1",
74
- "knip": "^5.41.0",
73
+ "knip": "^5.44.4",
75
74
  "minimist": "^1.2.8",
76
75
  "mocha": "^10.8.2",
77
76
  "mocha-fivemat-progress-reporter": "^0.1.0",
78
- "monocart-coverage-reports": "^2.11.4",
77
+ "monocart-coverage-reports": "^2.12.1",
79
78
  "ms": "^2.1.3",
80
- "playwright": "^1.49.1",
79
+ "picocolors": "^1.1.1",
80
+ "playwright": "^1.50.1",
81
81
  "source-map-support": "^0.5.21",
82
82
  "tslib": "^2.8.1",
83
- "typescript": "^5.7.2",
84
- "typescript-eslint": "^8.18.1",
83
+ "typescript": "^5.7.3",
84
+ "typescript-eslint": "^8.24.1",
85
85
  "which": "^3.0.1"
86
86
  },
87
87
  "overrides": {