@typescript-deploys/pr-build 5.7.0-pr-59924-15 → 5.7.0-pr-59975-15

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(
@@ -71450,8 +71445,11 @@ function createTypeChecker(host) {
71450
71445
  if (index < 0) return void 0;
71451
71446
  return getContextualTypeForElementExpression(parentType, index);
71452
71447
  }
71453
- const propertyName = getPropertyNameFromBindingElement(declaration);
71454
- return propertyName && getTypeOfPropertyOfType(parentType, propertyName);
71448
+ const nameType = getLiteralTypeFromPropertyName(name);
71449
+ if (isTypeUsableAsPropertyName(nameType)) {
71450
+ const text = getPropertyNameFromType(nameType);
71451
+ return getTypeOfPropertyOfType(parentType, text);
71452
+ }
71455
71453
  }
71456
71454
  function getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags) {
71457
71455
  const parentType = isExpression(declaration.parent) && getContextualType(declaration.parent, contextFlags);
@@ -72253,33 +72251,6 @@ function createTypeChecker(host) {
72253
72251
  }
72254
72252
  return void 0;
72255
72253
  }
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
72254
  function pushCachedContextualType(node) {
72284
72255
  pushContextualType(
72285
72256
  node,
@@ -79220,7 +79191,8 @@ function createTypeChecker(host) {
79220
79191
  void 0,
79221
79192
  checkMode || 0 /* Normal */
79222
79193
  ) : checkExpressionCached(initializer, checkMode));
79223
- if (isParameter(isBindingElement(declaration) ? walkUpBindingElementsAndPatterns(declaration) : declaration)) {
79194
+ const rootDeclaration = getRootDeclaration(declaration);
79195
+ if (isParameter(rootDeclaration) && !getEffectiveTypeAnnotationNode(rootDeclaration) && (!isFunctionLikeDeclaration(rootDeclaration.parent) || !getContextualSignatureForFunctionLikeDeclaration(rootDeclaration.parent))) {
79224
79196
  if (declaration.name.kind === 206 /* ObjectBindingPattern */ && isObjectLiteralType(type)) {
79225
79197
  return padObjectLiteralType(type, declaration.name);
79226
79198
  }
@@ -79231,41 +79203,33 @@ function createTypeChecker(host) {
79231
79203
  return type;
79232
79204
  }
79233
79205
  function padObjectLiteralType(type, pattern) {
79234
- let paddableElements;
79206
+ let missingElements;
79235
79207
  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);
79208
+ if (e.initializer) {
79209
+ const name = getPropertyNameFromBindingElement(e);
79210
+ if (name && !getPropertyOfType(type, name)) {
79211
+ missingElements = append(missingElements, e);
79212
+ }
79239
79213
  }
79240
79214
  }
79241
- if (!paddableElements) {
79215
+ if (!missingElements) {
79242
79216
  return type;
79243
79217
  }
79244
79218
  const members = createSymbolTable();
79245
79219
  for (const prop of getPropertiesOfObjectType(type)) {
79246
79220
  members.set(prop.escapedName, prop);
79247
79221
  }
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);
79222
+ for (const e of missingElements) {
79223
+ const symbol = createSymbol(4 /* Property */ | 16777216 /* Optional */, getPropertyNameFromBindingElement(e));
79259
79224
  symbol.links.type = getTypeFromBindingElement(
79260
79225
  e,
79261
79226
  /*includePatternInType*/
79262
79227
  false,
79263
79228
  /*reportErrors*/
79264
- true
79229
+ false
79265
79230
  );
79266
79231
  members.set(symbol.escapedName, symbol);
79267
79232
  }
79268
- popContextualType();
79269
79233
  const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, getIndexInfosOfType(type));
79270
79234
  result.objectFlags = type.objectFlags;
79271
79235
  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(
@@ -76046,8 +76041,11 @@ function createTypeChecker(host) {
76046
76041
  if (index < 0) return void 0;
76047
76042
  return getContextualTypeForElementExpression(parentType, index);
76048
76043
  }
76049
- const propertyName = getPropertyNameFromBindingElement(declaration);
76050
- return propertyName && getTypeOfPropertyOfType(parentType, propertyName);
76044
+ const nameType = getLiteralTypeFromPropertyName(name);
76045
+ if (isTypeUsableAsPropertyName(nameType)) {
76046
+ const text = getPropertyNameFromType(nameType);
76047
+ return getTypeOfPropertyOfType(parentType, text);
76048
+ }
76051
76049
  }
76052
76050
  function getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags) {
76053
76051
  const parentType = isExpression(declaration.parent) && getContextualType2(declaration.parent, contextFlags);
@@ -76849,33 +76847,6 @@ function createTypeChecker(host) {
76849
76847
  }
76850
76848
  return void 0;
76851
76849
  }
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
76850
  function pushCachedContextualType(node) {
76880
76851
  pushContextualType(
76881
76852
  node,
@@ -83816,7 +83787,8 @@ function createTypeChecker(host) {
83816
83787
  void 0,
83817
83788
  checkMode || 0 /* Normal */
83818
83789
  ) : checkExpressionCached(initializer, checkMode));
83819
- if (isParameter(isBindingElement(declaration) ? walkUpBindingElementsAndPatterns(declaration) : declaration)) {
83790
+ const rootDeclaration = getRootDeclaration(declaration);
83791
+ if (isParameter(rootDeclaration) && !getEffectiveTypeAnnotationNode(rootDeclaration) && (!isFunctionLikeDeclaration(rootDeclaration.parent) || !getContextualSignatureForFunctionLikeDeclaration(rootDeclaration.parent))) {
83820
83792
  if (declaration.name.kind === 206 /* ObjectBindingPattern */ && isObjectLiteralType2(type)) {
83821
83793
  return padObjectLiteralType(type, declaration.name);
83822
83794
  }
@@ -83827,41 +83799,33 @@ function createTypeChecker(host) {
83827
83799
  return type;
83828
83800
  }
83829
83801
  function padObjectLiteralType(type, pattern) {
83830
- let paddableElements;
83802
+ let missingElements;
83831
83803
  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);
83804
+ if (e.initializer) {
83805
+ const name = getPropertyNameFromBindingElement(e);
83806
+ if (name && !getPropertyOfType(type, name)) {
83807
+ missingElements = append(missingElements, e);
83808
+ }
83835
83809
  }
83836
83810
  }
83837
- if (!paddableElements) {
83811
+ if (!missingElements) {
83838
83812
  return type;
83839
83813
  }
83840
83814
  const members = createSymbolTable();
83841
83815
  for (const prop of getPropertiesOfObjectType(type)) {
83842
83816
  members.set(prop.escapedName, prop);
83843
83817
  }
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);
83818
+ for (const e of missingElements) {
83819
+ const symbol = createSymbol(4 /* Property */ | 16777216 /* Optional */, getPropertyNameFromBindingElement(e));
83855
83820
  symbol.links.type = getTypeFromBindingElement(
83856
83821
  e,
83857
83822
  /*includePatternInType*/
83858
83823
  false,
83859
83824
  /*reportErrors*/
83860
- true
83825
+ false
83861
83826
  );
83862
83827
  members.set(symbol.escapedName, symbol);
83863
83828
  }
83864
- popContextualType();
83865
83829
  const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, getIndexInfosOfType(type));
83866
83830
  result.objectFlags = type.objectFlags;
83867
83831
  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-59975-15",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [