@typescript-deploys/pr-build 5.7.0-pr-59924-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
@@ -55298,12 +55298,6 @@ function createTypeChecker(host) {
55298
55298
  if (isBindingPattern(element.name)) {
55299
55299
  return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors2);
55300
55300
  }
55301
- if (isBindingPattern(element.parent)) {
55302
- const contextualType = getContextualPaddingType(element);
55303
- if (contextualType) {
55304
- return contextualType;
55305
- }
55306
- }
55307
55301
  if (reportErrors2 && !declarationBelongsToPrivateAmbientMember(element)) {
55308
55302
  reportImplicitAny(element, anyType);
55309
55303
  }
@@ -55314,6 +55308,7 @@ function createTypeChecker(host) {
55314
55308
  let stringIndexInfo;
55315
55309
  let objectFlags = 128 /* ObjectLiteral */ | 131072 /* ContainsObjectOrArrayLiteral */;
55316
55310
  forEach(pattern.elements, (e) => {
55311
+ const name = e.propertyName || e.name;
55317
55312
  if (e.dotDotDotToken) {
55318
55313
  stringIndexInfo = createIndexInfo(
55319
55314
  stringType,
@@ -55323,16 +55318,16 @@ function createTypeChecker(host) {
55323
55318
  );
55324
55319
  return;
55325
55320
  }
55326
- const name = getPropertyNameFromBindingElement(e);
55327
- if (!name) {
55321
+ const exprType = getLiteralTypeFromPropertyName(name);
55322
+ if (!isTypeUsableAsPropertyName(exprType)) {
55328
55323
  objectFlags |= 512 /* ObjectLiteralPatternWithComputedProperties */;
55329
55324
  return;
55330
55325
  }
55331
- const contextualType = !includePatternInType && isBindingPattern(e.parent) ? getContextualPaddingType(e.parent) : void 0;
55332
- const paddingSymbol = contextualType && getPropertyOfType(contextualType, name);
55333
- const flags = 4 /* Property */ | (e.initializer || !includePatternInType && (!paddingSymbol || paddingSymbol.flags & 16777216 /* Optional */) ? 16777216 /* Optional */ : 0);
55334
- const symbol = createSymbol(flags, name);
55326
+ const text = getPropertyNameFromType(exprType);
55327
+ const flags = 4 /* Property */ | (e.initializer ? 16777216 /* Optional */ : 0);
55328
+ const symbol = createSymbol(flags, text);
55335
55329
  symbol.links.type = getTypeFromBindingElement(e, includePatternInType, reportErrors2);
55330
+ symbol.links.bindingElement = e;
55336
55331
  members.set(symbol.escapedName, symbol);
55337
55332
  });
55338
55333
  const result = createAnonymousType(
@@ -57003,8 +56998,13 @@ function createTypeChecker(host) {
57003
56998
  if (left.typeParameters && right.typeParameters) {
57004
56999
  paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
57005
57000
  }
57001
+ let flags = (left.flags | right.flags) & (167 /* PropagatingFlags */ & ~1 /* HasRestParameter */);
57006
57002
  const declaration = left.declaration;
57007
57003
  const params = combineUnionParameters(left, right, paramMapper);
57004
+ const lastParam = lastOrUndefined(params);
57005
+ if (lastParam && getCheckFlags(lastParam) & 32768 /* RestParameter */) {
57006
+ flags |= 1 /* HasRestParameter */;
57007
+ }
57008
57008
  const thisParam = combineUnionThisParam(left.thisParameter, right.thisParameter, paramMapper);
57009
57009
  const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
57010
57010
  const result = createSignature(
@@ -57017,7 +57017,7 @@ function createTypeChecker(host) {
57017
57017
  /*resolvedTypePredicate*/
57018
57018
  void 0,
57019
57019
  minArgCount,
57020
- (left.flags | right.flags) & 167 /* PropagatingFlags */
57020
+ flags
57021
57021
  );
57022
57022
  result.compositeKind = 1048576 /* Union */;
57023
57023
  result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
@@ -71450,8 +71450,11 @@ function createTypeChecker(host) {
71450
71450
  if (index < 0) return void 0;
71451
71451
  return getContextualTypeForElementExpression(parentType, index);
71452
71452
  }
71453
- const propertyName = getPropertyNameFromBindingElement(declaration);
71454
- return propertyName && getTypeOfPropertyOfType(parentType, propertyName);
71453
+ const nameType = getLiteralTypeFromPropertyName(name);
71454
+ if (isTypeUsableAsPropertyName(nameType)) {
71455
+ const text = getPropertyNameFromType(nameType);
71456
+ return getTypeOfPropertyOfType(parentType, text);
71457
+ }
71455
71458
  }
71456
71459
  function getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags) {
71457
71460
  const parentType = isExpression(declaration.parent) && getContextualType(declaration.parent, contextFlags);
@@ -72253,33 +72256,6 @@ function createTypeChecker(host) {
72253
72256
  }
72254
72257
  return void 0;
72255
72258
  }
72256
- function getContextualPaddingType(node) {
72257
- const index = findContextualNode(
72258
- node,
72259
- /*includeCaches*/
72260
- true
72261
- );
72262
- if (index >= 0) {
72263
- return contextualTypes[index];
72264
- }
72265
- const { parent } = node;
72266
- switch (parent.kind) {
72267
- case 206 /* ObjectBindingPattern */: {
72268
- const type = getContextualPaddingType(parent);
72269
- const name = type && getPropertyNameFromBindingElement(node);
72270
- return name ? getTypeOfPropertyOfType(type, name) : void 0;
72271
- }
72272
- case 208 /* BindingElement */: {
72273
- if (parent.parent.kind === 207 /* ArrayBindingPattern */) {
72274
- break;
72275
- }
72276
- const type = getContextualPaddingType(parent.parent);
72277
- const name = type && getPropertyNameFromBindingElement(parent);
72278
- return name ? getTypeOfPropertyOfType(type, name) : void 0;
72279
- }
72280
- }
72281
- return void 0;
72282
- }
72283
72259
  function pushCachedContextualType(node) {
72284
72260
  pushContextualType(
72285
72261
  node,
@@ -72474,13 +72450,14 @@ function createTypeChecker(host) {
72474
72450
  const paramName = leftName === rightName ? leftName : !leftName ? rightName : !rightName ? leftName : void 0;
72475
72451
  const paramSymbol = createSymbol(
72476
72452
  1 /* FunctionScopedVariable */ | (isOptional && !isRestParam ? 16777216 /* Optional */ : 0),
72477
- paramName || `arg${i}`
72453
+ paramName || `arg${i}`,
72454
+ isRestParam ? 32768 /* RestParameter */ : isOptional ? 16384 /* OptionalParameter */ : 0
72478
72455
  );
72479
72456
  paramSymbol.links.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
72480
72457
  params[i] = paramSymbol;
72481
72458
  }
72482
72459
  if (needsExtraRestElement) {
72483
- const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args");
72460
+ const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args", 32768 /* RestParameter */);
72484
72461
  restParamSymbol.links.type = createArrayType(getTypeAtPosition(shorter, longestCount));
72485
72462
  if (shorter === right) {
72486
72463
  restParamSymbol.links.type = instantiateType(restParamSymbol.links.type, mapper);
@@ -72495,8 +72472,13 @@ function createTypeChecker(host) {
72495
72472
  if (left.typeParameters && right.typeParameters) {
72496
72473
  paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
72497
72474
  }
72475
+ let flags = (left.flags | right.flags) & (167 /* PropagatingFlags */ & ~1 /* HasRestParameter */);
72498
72476
  const declaration = left.declaration;
72499
72477
  const params = combineIntersectionParameters(left, right, paramMapper);
72478
+ const lastParam = lastOrUndefined(params);
72479
+ if (lastParam && getCheckFlags(lastParam) & 32768 /* RestParameter */) {
72480
+ flags |= 1 /* HasRestParameter */;
72481
+ }
72500
72482
  const thisParam = combineIntersectionThisParam(left.thisParameter, right.thisParameter, paramMapper);
72501
72483
  const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
72502
72484
  const result = createSignature(
@@ -72509,7 +72491,7 @@ function createTypeChecker(host) {
72509
72491
  /*resolvedTypePredicate*/
72510
72492
  void 0,
72511
72493
  minArgCount,
72512
- (left.flags | right.flags) & 167 /* PropagatingFlags */
72494
+ flags
72513
72495
  );
72514
72496
  result.compositeKind = 2097152 /* Intersection */;
72515
72497
  result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
@@ -76968,10 +76950,14 @@ function createTypeChecker(host) {
76968
76950
  function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) {
76969
76951
  return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType;
76970
76952
  }
76971
- function inferFromAnnotatedParameters(signature, context, inferenceContext) {
76972
- const len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
76973
- for (let i = 0; i < len; i++) {
76974
- 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];
76975
76961
  const typeNode = getEffectiveTypeAnnotationNode(declaration);
76976
76962
  if (typeNode) {
76977
76963
  const source = addOptionality(
@@ -76980,7 +76966,7 @@ function createTypeChecker(host) {
76980
76966
  false,
76981
76967
  isOptionalDeclaration(declaration)
76982
76968
  );
76983
- const target = getTypeAtPosition(context, i);
76969
+ const target = getTypeAtPosition(contextualSignature, i - thisParameterOffset);
76984
76970
  inferTypes(inferenceContext.inferences, source, target);
76985
76971
  }
76986
76972
  }
@@ -77748,6 +77734,12 @@ function createTypeChecker(host) {
77748
77734
  return links.contextFreeType = returnOnlyType;
77749
77735
  }
77750
77736
  }
77737
+ if (checkMode & 2 /* Inferential */) {
77738
+ const contextualSignature = getContextualSignature(node);
77739
+ if (contextualSignature) {
77740
+ inferFromAnnotatedParameters(node, contextualSignature, getInferenceContext(node));
77741
+ }
77742
+ }
77751
77743
  return anyFunctionType;
77752
77744
  }
77753
77745
  const hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
@@ -77772,7 +77764,7 @@ function createTypeChecker(host) {
77772
77764
  const inferenceContext = getInferenceContext(node);
77773
77765
  let instantiatedContextualSignature;
77774
77766
  if (checkMode && checkMode & 2 /* Inferential */) {
77775
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
77767
+ inferFromAnnotatedParameters(node, contextualSignature, inferenceContext);
77776
77768
  const restType = getEffectiveRestType(contextualSignature);
77777
77769
  if (restType && restType.flags & 262144 /* TypeParameter */) {
77778
77770
  instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
@@ -77786,7 +77778,7 @@ function createTypeChecker(host) {
77786
77778
  } else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
77787
77779
  const inferenceContext = getInferenceContext(node);
77788
77780
  if (checkMode && checkMode & 2 /* Inferential */) {
77789
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
77781
+ inferFromAnnotatedParameters(node, contextualSignature, inferenceContext);
77790
77782
  }
77791
77783
  }
77792
77784
  if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
@@ -79231,41 +79223,33 @@ function createTypeChecker(host) {
79231
79223
  return type;
79232
79224
  }
79233
79225
  function padObjectLiteralType(type, pattern) {
79234
- let paddableElements;
79226
+ let missingElements;
79235
79227
  for (const e of pattern.elements) {
79236
- const name = getPropertyNameFromBindingElement(e);
79237
- if (name && (!getPropertyOfType(type, name) || isBindingPattern(e.name))) {
79238
- paddableElements = append(paddableElements, e);
79228
+ if (e.initializer) {
79229
+ const name = getPropertyNameFromBindingElement(e);
79230
+ if (name && !getPropertyOfType(type, name)) {
79231
+ missingElements = append(missingElements, e);
79232
+ }
79239
79233
  }
79240
79234
  }
79241
- if (!paddableElements) {
79235
+ if (!missingElements) {
79242
79236
  return type;
79243
79237
  }
79244
79238
  const members = createSymbolTable();
79245
79239
  for (const prop of getPropertiesOfObjectType(type)) {
79246
79240
  members.set(prop.escapedName, prop);
79247
79241
  }
79248
- pushContextualType(
79249
- pattern,
79250
- type,
79251
- /*isCache*/
79252
- true
79253
- );
79254
- for (const e of paddableElements) {
79255
- const name = getPropertyNameFromBindingElement(e);
79256
- const paddingSymbol = getPropertyOfType(type, name);
79257
- const isOptional = e.initializer && !paddingSymbol || !members.has(name) || paddingSymbol && paddingSymbol.flags & 16777216 /* Optional */;
79258
- const symbol = createSymbol(4 /* Property */ | (isOptional || !members.has(name) ? 16777216 /* Optional */ : 0), name);
79242
+ for (const e of missingElements) {
79243
+ const symbol = createSymbol(4 /* Property */ | 16777216 /* Optional */, getPropertyNameFromBindingElement(e));
79259
79244
  symbol.links.type = getTypeFromBindingElement(
79260
79245
  e,
79261
79246
  /*includePatternInType*/
79262
79247
  false,
79263
79248
  /*reportErrors*/
79264
- true
79249
+ false
79265
79250
  );
79266
79251
  members.set(symbol.escapedName, symbol);
79267
79252
  }
79268
- popContextualType();
79269
79253
  const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, getIndexInfosOfType(type));
79270
79254
  result.objectFlags = type.objectFlags;
79271
79255
  return result;
@@ -8773,6 +8773,7 @@ declare namespace ts {
8773
8773
  function isJSDocCommentContainingNode(node: Node): boolean;
8774
8774
  function isSetAccessor(node: Node): node is SetAccessorDeclaration;
8775
8775
  function isGetAccessor(node: Node): node is GetAccessorDeclaration;
8776
+ /** True if has initializer node attached to it. */
8776
8777
  function hasOnlyExpressionInitializer(node: Node): node is HasExpressionInitializer;
8777
8778
  function isObjectLiteralElement(node: Node): node is ObjectLiteralElement;
8778
8779
  function isStringLiteralLike(node: Node | FileReference): node is StringLiteralLike;
package/lib/typescript.js CHANGED
@@ -59894,12 +59894,6 @@ function createTypeChecker(host) {
59894
59894
  if (isBindingPattern(element.name)) {
59895
59895
  return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors2);
59896
59896
  }
59897
- if (isBindingPattern(element.parent)) {
59898
- const contextualType = getContextualPaddingType(element);
59899
- if (contextualType) {
59900
- return contextualType;
59901
- }
59902
- }
59903
59897
  if (reportErrors2 && !declarationBelongsToPrivateAmbientMember(element)) {
59904
59898
  reportImplicitAny(element, anyType);
59905
59899
  }
@@ -59910,6 +59904,7 @@ function createTypeChecker(host) {
59910
59904
  let stringIndexInfo;
59911
59905
  let objectFlags = 128 /* ObjectLiteral */ | 131072 /* ContainsObjectOrArrayLiteral */;
59912
59906
  forEach(pattern.elements, (e) => {
59907
+ const name = e.propertyName || e.name;
59913
59908
  if (e.dotDotDotToken) {
59914
59909
  stringIndexInfo = createIndexInfo(
59915
59910
  stringType,
@@ -59919,16 +59914,16 @@ function createTypeChecker(host) {
59919
59914
  );
59920
59915
  return;
59921
59916
  }
59922
- const name = getPropertyNameFromBindingElement(e);
59923
- if (!name) {
59917
+ const exprType = getLiteralTypeFromPropertyName(name);
59918
+ if (!isTypeUsableAsPropertyName(exprType)) {
59924
59919
  objectFlags |= 512 /* ObjectLiteralPatternWithComputedProperties */;
59925
59920
  return;
59926
59921
  }
59927
- const contextualType = !includePatternInType && isBindingPattern(e.parent) ? getContextualPaddingType(e.parent) : void 0;
59928
- const paddingSymbol = contextualType && getPropertyOfType(contextualType, name);
59929
- const flags = 4 /* Property */ | (e.initializer || !includePatternInType && (!paddingSymbol || paddingSymbol.flags & 16777216 /* Optional */) ? 16777216 /* Optional */ : 0);
59930
- const symbol = createSymbol(flags, name);
59922
+ const text = getPropertyNameFromType(exprType);
59923
+ const flags = 4 /* Property */ | (e.initializer ? 16777216 /* Optional */ : 0);
59924
+ const symbol = createSymbol(flags, text);
59931
59925
  symbol.links.type = getTypeFromBindingElement(e, includePatternInType, reportErrors2);
59926
+ symbol.links.bindingElement = e;
59932
59927
  members.set(symbol.escapedName, symbol);
59933
59928
  });
59934
59929
  const result = createAnonymousType(
@@ -61599,8 +61594,13 @@ function createTypeChecker(host) {
61599
61594
  if (left.typeParameters && right.typeParameters) {
61600
61595
  paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
61601
61596
  }
61597
+ let flags = (left.flags | right.flags) & (167 /* PropagatingFlags */ & ~1 /* HasRestParameter */);
61602
61598
  const declaration = left.declaration;
61603
61599
  const params = combineUnionParameters(left, right, paramMapper);
61600
+ const lastParam = lastOrUndefined(params);
61601
+ if (lastParam && getCheckFlags(lastParam) & 32768 /* RestParameter */) {
61602
+ flags |= 1 /* HasRestParameter */;
61603
+ }
61604
61604
  const thisParam = combineUnionThisParam(left.thisParameter, right.thisParameter, paramMapper);
61605
61605
  const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
61606
61606
  const result = createSignature(
@@ -61613,7 +61613,7 @@ function createTypeChecker(host) {
61613
61613
  /*resolvedTypePredicate*/
61614
61614
  void 0,
61615
61615
  minArgCount,
61616
- (left.flags | right.flags) & 167 /* PropagatingFlags */
61616
+ flags
61617
61617
  );
61618
61618
  result.compositeKind = 1048576 /* Union */;
61619
61619
  result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
@@ -76046,8 +76046,11 @@ function createTypeChecker(host) {
76046
76046
  if (index < 0) return void 0;
76047
76047
  return getContextualTypeForElementExpression(parentType, index);
76048
76048
  }
76049
- const propertyName = getPropertyNameFromBindingElement(declaration);
76050
- return propertyName && getTypeOfPropertyOfType(parentType, propertyName);
76049
+ const nameType = getLiteralTypeFromPropertyName(name);
76050
+ if (isTypeUsableAsPropertyName(nameType)) {
76051
+ const text = getPropertyNameFromType(nameType);
76052
+ return getTypeOfPropertyOfType(parentType, text);
76053
+ }
76051
76054
  }
76052
76055
  function getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags) {
76053
76056
  const parentType = isExpression(declaration.parent) && getContextualType2(declaration.parent, contextFlags);
@@ -76849,33 +76852,6 @@ function createTypeChecker(host) {
76849
76852
  }
76850
76853
  return void 0;
76851
76854
  }
76852
- function getContextualPaddingType(node) {
76853
- const index = findContextualNode(
76854
- node,
76855
- /*includeCaches*/
76856
- true
76857
- );
76858
- if (index >= 0) {
76859
- return contextualTypes[index];
76860
- }
76861
- const { parent: parent2 } = node;
76862
- switch (parent2.kind) {
76863
- case 206 /* ObjectBindingPattern */: {
76864
- const type = getContextualPaddingType(parent2);
76865
- const name = type && getPropertyNameFromBindingElement(node);
76866
- return name ? getTypeOfPropertyOfType(type, name) : void 0;
76867
- }
76868
- case 208 /* BindingElement */: {
76869
- if (parent2.parent.kind === 207 /* ArrayBindingPattern */) {
76870
- break;
76871
- }
76872
- const type = getContextualPaddingType(parent2.parent);
76873
- const name = type && getPropertyNameFromBindingElement(parent2);
76874
- return name ? getTypeOfPropertyOfType(type, name) : void 0;
76875
- }
76876
- }
76877
- return void 0;
76878
- }
76879
76855
  function pushCachedContextualType(node) {
76880
76856
  pushContextualType(
76881
76857
  node,
@@ -77070,13 +77046,14 @@ function createTypeChecker(host) {
77070
77046
  const paramName = leftName === rightName ? leftName : !leftName ? rightName : !rightName ? leftName : void 0;
77071
77047
  const paramSymbol = createSymbol(
77072
77048
  1 /* FunctionScopedVariable */ | (isOptional && !isRestParam ? 16777216 /* Optional */ : 0),
77073
- paramName || `arg${i}`
77049
+ paramName || `arg${i}`,
77050
+ isRestParam ? 32768 /* RestParameter */ : isOptional ? 16384 /* OptionalParameter */ : 0
77074
77051
  );
77075
77052
  paramSymbol.links.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
77076
77053
  params[i] = paramSymbol;
77077
77054
  }
77078
77055
  if (needsExtraRestElement) {
77079
- const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args");
77056
+ const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args", 32768 /* RestParameter */);
77080
77057
  restParamSymbol.links.type = createArrayType(getTypeAtPosition(shorter, longestCount));
77081
77058
  if (shorter === right) {
77082
77059
  restParamSymbol.links.type = instantiateType(restParamSymbol.links.type, mapper);
@@ -77091,8 +77068,13 @@ function createTypeChecker(host) {
77091
77068
  if (left.typeParameters && right.typeParameters) {
77092
77069
  paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
77093
77070
  }
77071
+ let flags = (left.flags | right.flags) & (167 /* PropagatingFlags */ & ~1 /* HasRestParameter */);
77094
77072
  const declaration = left.declaration;
77095
77073
  const params = combineIntersectionParameters(left, right, paramMapper);
77074
+ const lastParam = lastOrUndefined(params);
77075
+ if (lastParam && getCheckFlags(lastParam) & 32768 /* RestParameter */) {
77076
+ flags |= 1 /* HasRestParameter */;
77077
+ }
77096
77078
  const thisParam = combineIntersectionThisParam(left.thisParameter, right.thisParameter, paramMapper);
77097
77079
  const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
77098
77080
  const result = createSignature(
@@ -77105,7 +77087,7 @@ function createTypeChecker(host) {
77105
77087
  /*resolvedTypePredicate*/
77106
77088
  void 0,
77107
77089
  minArgCount,
77108
- (left.flags | right.flags) & 167 /* PropagatingFlags */
77090
+ flags
77109
77091
  );
77110
77092
  result.compositeKind = 2097152 /* Intersection */;
77111
77093
  result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
@@ -81564,10 +81546,14 @@ function createTypeChecker(host) {
81564
81546
  function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) {
81565
81547
  return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType;
81566
81548
  }
81567
- function inferFromAnnotatedParameters(signature, context, inferenceContext) {
81568
- const len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
81569
- for (let i = 0; i < len; i++) {
81570
- 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];
81571
81557
  const typeNode = getEffectiveTypeAnnotationNode(declaration);
81572
81558
  if (typeNode) {
81573
81559
  const source = addOptionality(
@@ -81576,7 +81562,7 @@ function createTypeChecker(host) {
81576
81562
  false,
81577
81563
  isOptionalDeclaration(declaration)
81578
81564
  );
81579
- const target = getTypeAtPosition(context, i);
81565
+ const target = getTypeAtPosition(contextualSignature, i - thisParameterOffset);
81580
81566
  inferTypes(inferenceContext.inferences, source, target);
81581
81567
  }
81582
81568
  }
@@ -82344,6 +82330,12 @@ function createTypeChecker(host) {
82344
82330
  return links.contextFreeType = returnOnlyType;
82345
82331
  }
82346
82332
  }
82333
+ if (checkMode & 2 /* Inferential */) {
82334
+ const contextualSignature = getContextualSignature(node);
82335
+ if (contextualSignature) {
82336
+ inferFromAnnotatedParameters(node, contextualSignature, getInferenceContext(node));
82337
+ }
82338
+ }
82347
82339
  return anyFunctionType;
82348
82340
  }
82349
82341
  const hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
@@ -82368,7 +82360,7 @@ function createTypeChecker(host) {
82368
82360
  const inferenceContext = getInferenceContext(node);
82369
82361
  let instantiatedContextualSignature;
82370
82362
  if (checkMode && checkMode & 2 /* Inferential */) {
82371
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
82363
+ inferFromAnnotatedParameters(node, contextualSignature, inferenceContext);
82372
82364
  const restType = getEffectiveRestType(contextualSignature);
82373
82365
  if (restType && restType.flags & 262144 /* TypeParameter */) {
82374
82366
  instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
@@ -82382,7 +82374,7 @@ function createTypeChecker(host) {
82382
82374
  } else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
82383
82375
  const inferenceContext = getInferenceContext(node);
82384
82376
  if (checkMode && checkMode & 2 /* Inferential */) {
82385
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
82377
+ inferFromAnnotatedParameters(node, contextualSignature, inferenceContext);
82386
82378
  }
82387
82379
  }
82388
82380
  if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
@@ -83827,41 +83819,33 @@ function createTypeChecker(host) {
83827
83819
  return type;
83828
83820
  }
83829
83821
  function padObjectLiteralType(type, pattern) {
83830
- let paddableElements;
83822
+ let missingElements;
83831
83823
  for (const e of pattern.elements) {
83832
- const name = getPropertyNameFromBindingElement(e);
83833
- if (name && (!getPropertyOfType(type, name) || isBindingPattern(e.name))) {
83834
- paddableElements = append(paddableElements, e);
83824
+ if (e.initializer) {
83825
+ const name = getPropertyNameFromBindingElement(e);
83826
+ if (name && !getPropertyOfType(type, name)) {
83827
+ missingElements = append(missingElements, e);
83828
+ }
83835
83829
  }
83836
83830
  }
83837
- if (!paddableElements) {
83831
+ if (!missingElements) {
83838
83832
  return type;
83839
83833
  }
83840
83834
  const members = createSymbolTable();
83841
83835
  for (const prop of getPropertiesOfObjectType(type)) {
83842
83836
  members.set(prop.escapedName, prop);
83843
83837
  }
83844
- pushContextualType(
83845
- pattern,
83846
- type,
83847
- /*isCache*/
83848
- true
83849
- );
83850
- for (const e of paddableElements) {
83851
- const name = getPropertyNameFromBindingElement(e);
83852
- const paddingSymbol = getPropertyOfType(type, name);
83853
- const isOptional = e.initializer && !paddingSymbol || !members.has(name) || paddingSymbol && paddingSymbol.flags & 16777216 /* Optional */;
83854
- const symbol = createSymbol(4 /* Property */ | (isOptional || !members.has(name) ? 16777216 /* Optional */ : 0), name);
83838
+ for (const e of missingElements) {
83839
+ const symbol = createSymbol(4 /* Property */ | 16777216 /* Optional */, getPropertyNameFromBindingElement(e));
83855
83840
  symbol.links.type = getTypeFromBindingElement(
83856
83841
  e,
83857
83842
  /*includePatternInType*/
83858
83843
  false,
83859
83844
  /*reportErrors*/
83860
- true
83845
+ false
83861
83846
  );
83862
83847
  members.set(symbol.escapedName, symbol);
83863
83848
  }
83864
- popContextualType();
83865
83849
  const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, getIndexInfosOfType(type));
83866
83850
  result.objectFlags = type.objectFlags;
83867
83851
  return result;
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-59924-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": [