@typescript-deploys/pr-build 5.7.0-pr-59975-15 → 5.7.0-pr-56460-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
@@ -56998,8 +56998,13 @@ function createTypeChecker(host) {
56998
56998
  if (left.typeParameters && right.typeParameters) {
56999
56999
  paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
57000
57000
  }
57001
+ let flags = (left.flags | right.flags) & (167 /* PropagatingFlags */ & ~1 /* HasRestParameter */);
57001
57002
  const declaration = left.declaration;
57002
57003
  const params = combineUnionParameters(left, right, paramMapper);
57004
+ const lastParam = lastOrUndefined(params);
57005
+ if (lastParam && getCheckFlags(lastParam) & 32768 /* RestParameter */) {
57006
+ flags |= 1 /* HasRestParameter */;
57007
+ }
57003
57008
  const thisParam = combineUnionThisParam(left.thisParameter, right.thisParameter, paramMapper);
57004
57009
  const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
57005
57010
  const result = createSignature(
@@ -57012,7 +57017,7 @@ function createTypeChecker(host) {
57012
57017
  /*resolvedTypePredicate*/
57013
57018
  void 0,
57014
57019
  minArgCount,
57015
- (left.flags | right.flags) & 167 /* PropagatingFlags */
57020
+ flags
57016
57021
  );
57017
57022
  result.compositeKind = 1048576 /* Union */;
57018
57023
  result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
@@ -72445,13 +72450,14 @@ function createTypeChecker(host) {
72445
72450
  const paramName = leftName === rightName ? leftName : !leftName ? rightName : !rightName ? leftName : void 0;
72446
72451
  const paramSymbol = createSymbol(
72447
72452
  1 /* FunctionScopedVariable */ | (isOptional && !isRestParam ? 16777216 /* Optional */ : 0),
72448
- paramName || `arg${i}`
72453
+ paramName || `arg${i}`,
72454
+ isRestParam ? 32768 /* RestParameter */ : isOptional ? 16384 /* OptionalParameter */ : 0
72449
72455
  );
72450
72456
  paramSymbol.links.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
72451
72457
  params[i] = paramSymbol;
72452
72458
  }
72453
72459
  if (needsExtraRestElement) {
72454
- const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args");
72460
+ const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args", 32768 /* RestParameter */);
72455
72461
  restParamSymbol.links.type = createArrayType(getTypeAtPosition(shorter, longestCount));
72456
72462
  if (shorter === right) {
72457
72463
  restParamSymbol.links.type = instantiateType(restParamSymbol.links.type, mapper);
@@ -72466,8 +72472,13 @@ function createTypeChecker(host) {
72466
72472
  if (left.typeParameters && right.typeParameters) {
72467
72473
  paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
72468
72474
  }
72475
+ let flags = (left.flags | right.flags) & (167 /* PropagatingFlags */ & ~1 /* HasRestParameter */);
72469
72476
  const declaration = left.declaration;
72470
72477
  const params = combineIntersectionParameters(left, right, paramMapper);
72478
+ const lastParam = lastOrUndefined(params);
72479
+ if (lastParam && getCheckFlags(lastParam) & 32768 /* RestParameter */) {
72480
+ flags |= 1 /* HasRestParameter */;
72481
+ }
72471
72482
  const thisParam = combineIntersectionThisParam(left.thisParameter, right.thisParameter, paramMapper);
72472
72483
  const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
72473
72484
  const result = createSignature(
@@ -72480,7 +72491,7 @@ function createTypeChecker(host) {
72480
72491
  /*resolvedTypePredicate*/
72481
72492
  void 0,
72482
72493
  minArgCount,
72483
- (left.flags | right.flags) & 167 /* PropagatingFlags */
72494
+ flags
72484
72495
  );
72485
72496
  result.compositeKind = 2097152 /* Intersection */;
72486
72497
  result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
@@ -76939,10 +76950,14 @@ function createTypeChecker(host) {
76939
76950
  function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) {
76940
76951
  return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType;
76941
76952
  }
76942
- function inferFromAnnotatedParameters(signature, context, inferenceContext) {
76943
- const len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
76944
- for (let i = 0; i < len; i++) {
76945
- const declaration = signature.parameters[i].valueDeclaration;
76953
+ function inferFromAnnotatedParameters(node, contextualSignature, inferenceContext) {
76954
+ if (!node.parameters.length) {
76955
+ return;
76956
+ }
76957
+ const len = node.parameters.length - (last(node.parameters).dotDotDotToken ? 1 : 0);
76958
+ const thisParameterOffset = first(node.parameters).symbol.escapedName === "this" /* This */ ? 1 : 0;
76959
+ for (let i = thisParameterOffset; i < len; i++) {
76960
+ const declaration = node.parameters[i];
76946
76961
  const typeNode = getEffectiveTypeAnnotationNode(declaration);
76947
76962
  if (typeNode) {
76948
76963
  const source = addOptionality(
@@ -76951,7 +76966,7 @@ function createTypeChecker(host) {
76951
76966
  false,
76952
76967
  isOptionalDeclaration(declaration)
76953
76968
  );
76954
- const target = getTypeAtPosition(context, i);
76969
+ const target = getTypeAtPosition(contextualSignature, i - thisParameterOffset);
76955
76970
  inferTypes(inferenceContext.inferences, source, target);
76956
76971
  }
76957
76972
  }
@@ -77719,6 +77734,12 @@ function createTypeChecker(host) {
77719
77734
  return links.contextFreeType = returnOnlyType;
77720
77735
  }
77721
77736
  }
77737
+ if (checkMode & 2 /* Inferential */) {
77738
+ const contextualSignature = getContextualSignature(node);
77739
+ if (contextualSignature) {
77740
+ inferFromAnnotatedParameters(node, contextualSignature, getInferenceContext(node));
77741
+ }
77742
+ }
77722
77743
  return anyFunctionType;
77723
77744
  }
77724
77745
  const hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
@@ -77743,7 +77764,7 @@ function createTypeChecker(host) {
77743
77764
  const inferenceContext = getInferenceContext(node);
77744
77765
  let instantiatedContextualSignature;
77745
77766
  if (checkMode && checkMode & 2 /* Inferential */) {
77746
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
77767
+ inferFromAnnotatedParameters(node, contextualSignature, inferenceContext);
77747
77768
  const restType = getEffectiveRestType(contextualSignature);
77748
77769
  if (restType && restType.flags & 262144 /* TypeParameter */) {
77749
77770
  instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
@@ -77757,7 +77778,7 @@ function createTypeChecker(host) {
77757
77778
  } else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
77758
77779
  const inferenceContext = getInferenceContext(node);
77759
77780
  if (checkMode && checkMode & 2 /* Inferential */) {
77760
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
77781
+ inferFromAnnotatedParameters(node, contextualSignature, inferenceContext);
77761
77782
  }
77762
77783
  }
77763
77784
  if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
@@ -79191,8 +79212,7 @@ function createTypeChecker(host) {
79191
79212
  void 0,
79192
79213
  checkMode || 0 /* Normal */
79193
79214
  ) : checkExpressionCached(initializer, checkMode));
79194
- const rootDeclaration = getRootDeclaration(declaration);
79195
- if (isParameter(rootDeclaration) && !getEffectiveTypeAnnotationNode(rootDeclaration) && (!isFunctionLikeDeclaration(rootDeclaration.parent) || !getContextualSignatureForFunctionLikeDeclaration(rootDeclaration.parent))) {
79215
+ if (isParameter(isBindingElement(declaration) ? walkUpBindingElementsAndPatterns(declaration) : declaration)) {
79196
79216
  if (declaration.name.kind === 206 /* ObjectBindingPattern */ && isObjectLiteralType(type)) {
79197
79217
  return padObjectLiteralType(type, declaration.name);
79198
79218
  }
package/lib/typescript.js CHANGED
@@ -61594,8 +61594,13 @@ function createTypeChecker(host) {
61594
61594
  if (left.typeParameters && right.typeParameters) {
61595
61595
  paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
61596
61596
  }
61597
+ let flags = (left.flags | right.flags) & (167 /* PropagatingFlags */ & ~1 /* HasRestParameter */);
61597
61598
  const declaration = left.declaration;
61598
61599
  const params = combineUnionParameters(left, right, paramMapper);
61600
+ const lastParam = lastOrUndefined(params);
61601
+ if (lastParam && getCheckFlags(lastParam) & 32768 /* RestParameter */) {
61602
+ flags |= 1 /* HasRestParameter */;
61603
+ }
61599
61604
  const thisParam = combineUnionThisParam(left.thisParameter, right.thisParameter, paramMapper);
61600
61605
  const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
61601
61606
  const result = createSignature(
@@ -61608,7 +61613,7 @@ function createTypeChecker(host) {
61608
61613
  /*resolvedTypePredicate*/
61609
61614
  void 0,
61610
61615
  minArgCount,
61611
- (left.flags | right.flags) & 167 /* PropagatingFlags */
61616
+ flags
61612
61617
  );
61613
61618
  result.compositeKind = 1048576 /* Union */;
61614
61619
  result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
@@ -77041,13 +77046,14 @@ function createTypeChecker(host) {
77041
77046
  const paramName = leftName === rightName ? leftName : !leftName ? rightName : !rightName ? leftName : void 0;
77042
77047
  const paramSymbol = createSymbol(
77043
77048
  1 /* FunctionScopedVariable */ | (isOptional && !isRestParam ? 16777216 /* Optional */ : 0),
77044
- paramName || `arg${i}`
77049
+ paramName || `arg${i}`,
77050
+ isRestParam ? 32768 /* RestParameter */ : isOptional ? 16384 /* OptionalParameter */ : 0
77045
77051
  );
77046
77052
  paramSymbol.links.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
77047
77053
  params[i] = paramSymbol;
77048
77054
  }
77049
77055
  if (needsExtraRestElement) {
77050
- const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args");
77056
+ const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args", 32768 /* RestParameter */);
77051
77057
  restParamSymbol.links.type = createArrayType(getTypeAtPosition(shorter, longestCount));
77052
77058
  if (shorter === right) {
77053
77059
  restParamSymbol.links.type = instantiateType(restParamSymbol.links.type, mapper);
@@ -77062,8 +77068,13 @@ function createTypeChecker(host) {
77062
77068
  if (left.typeParameters && right.typeParameters) {
77063
77069
  paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
77064
77070
  }
77071
+ let flags = (left.flags | right.flags) & (167 /* PropagatingFlags */ & ~1 /* HasRestParameter */);
77065
77072
  const declaration = left.declaration;
77066
77073
  const params = combineIntersectionParameters(left, right, paramMapper);
77074
+ const lastParam = lastOrUndefined(params);
77075
+ if (lastParam && getCheckFlags(lastParam) & 32768 /* RestParameter */) {
77076
+ flags |= 1 /* HasRestParameter */;
77077
+ }
77067
77078
  const thisParam = combineIntersectionThisParam(left.thisParameter, right.thisParameter, paramMapper);
77068
77079
  const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
77069
77080
  const result = createSignature(
@@ -77076,7 +77087,7 @@ function createTypeChecker(host) {
77076
77087
  /*resolvedTypePredicate*/
77077
77088
  void 0,
77078
77089
  minArgCount,
77079
- (left.flags | right.flags) & 167 /* PropagatingFlags */
77090
+ flags
77080
77091
  );
77081
77092
  result.compositeKind = 2097152 /* Intersection */;
77082
77093
  result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
@@ -81535,10 +81546,14 @@ function createTypeChecker(host) {
81535
81546
  function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) {
81536
81547
  return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType;
81537
81548
  }
81538
- function inferFromAnnotatedParameters(signature, context, inferenceContext) {
81539
- const len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
81540
- for (let i = 0; i < len; i++) {
81541
- const declaration = signature.parameters[i].valueDeclaration;
81549
+ function inferFromAnnotatedParameters(node, contextualSignature, inferenceContext) {
81550
+ if (!node.parameters.length) {
81551
+ return;
81552
+ }
81553
+ const len = node.parameters.length - (last(node.parameters).dotDotDotToken ? 1 : 0);
81554
+ const thisParameterOffset = first(node.parameters).symbol.escapedName === "this" /* This */ ? 1 : 0;
81555
+ for (let i = thisParameterOffset; i < len; i++) {
81556
+ const declaration = node.parameters[i];
81542
81557
  const typeNode = getEffectiveTypeAnnotationNode(declaration);
81543
81558
  if (typeNode) {
81544
81559
  const source = addOptionality(
@@ -81547,7 +81562,7 @@ function createTypeChecker(host) {
81547
81562
  false,
81548
81563
  isOptionalDeclaration(declaration)
81549
81564
  );
81550
- const target = getTypeAtPosition(context, i);
81565
+ const target = getTypeAtPosition(contextualSignature, i - thisParameterOffset);
81551
81566
  inferTypes(inferenceContext.inferences, source, target);
81552
81567
  }
81553
81568
  }
@@ -82315,6 +82330,12 @@ function createTypeChecker(host) {
82315
82330
  return links.contextFreeType = returnOnlyType;
82316
82331
  }
82317
82332
  }
82333
+ if (checkMode & 2 /* Inferential */) {
82334
+ const contextualSignature = getContextualSignature(node);
82335
+ if (contextualSignature) {
82336
+ inferFromAnnotatedParameters(node, contextualSignature, getInferenceContext(node));
82337
+ }
82338
+ }
82318
82339
  return anyFunctionType;
82319
82340
  }
82320
82341
  const hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
@@ -82339,7 +82360,7 @@ function createTypeChecker(host) {
82339
82360
  const inferenceContext = getInferenceContext(node);
82340
82361
  let instantiatedContextualSignature;
82341
82362
  if (checkMode && checkMode & 2 /* Inferential */) {
82342
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
82363
+ inferFromAnnotatedParameters(node, contextualSignature, inferenceContext);
82343
82364
  const restType = getEffectiveRestType(contextualSignature);
82344
82365
  if (restType && restType.flags & 262144 /* TypeParameter */) {
82345
82366
  instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
@@ -82353,7 +82374,7 @@ function createTypeChecker(host) {
82353
82374
  } else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
82354
82375
  const inferenceContext = getInferenceContext(node);
82355
82376
  if (checkMode && checkMode & 2 /* Inferential */) {
82356
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
82377
+ inferFromAnnotatedParameters(node, contextualSignature, inferenceContext);
82357
82378
  }
82358
82379
  }
82359
82380
  if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
@@ -83787,8 +83808,7 @@ function createTypeChecker(host) {
83787
83808
  void 0,
83788
83809
  checkMode || 0 /* Normal */
83789
83810
  ) : checkExpressionCached(initializer, checkMode));
83790
- const rootDeclaration = getRootDeclaration(declaration);
83791
- if (isParameter(rootDeclaration) && !getEffectiveTypeAnnotationNode(rootDeclaration) && (!isFunctionLikeDeclaration(rootDeclaration.parent) || !getContextualSignatureForFunctionLikeDeclaration(rootDeclaration.parent))) {
83811
+ if (isParameter(isBindingElement(declaration) ? walkUpBindingElementsAndPatterns(declaration) : declaration)) {
83792
83812
  if (declaration.name.kind === 206 /* ObjectBindingPattern */ && isObjectLiteralType2(type)) {
83793
83813
  return padObjectLiteralType(type, declaration.name);
83794
83814
  }
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.7.0-pr-59975-15",
5
+ "version": "5.7.0-pr-56460-9",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [