@typescript-deploys/pr-build 5.6.0-pr-58514-9 → 5.6.0-pr-58829-3

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
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.6";
21
- var version = `${versionMajorMinor}.0-insiders.20240610`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240611`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -7551,6 +7551,8 @@ var Diagnostics = {
7551
7551
  Default_exports_can_t_be_inferred_with_isolatedDeclarations: diag(9037, 1 /* Error */, "Default_exports_can_t_be_inferred_with_isolatedDeclarations_9037", "Default exports can't be inferred with --isolatedDeclarations."),
7552
7552
  Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations: diag(9038, 1 /* Error */, "Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations_9038", "Computed property names on class or object literals cannot be inferred with --isolatedDeclarations."),
7553
7553
  Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations: diag(9039, 1 /* Error */, "Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations_9039", "Type containing private name '{0}' can't be used with --isolatedDeclarations."),
7554
+ keyof_type_must_have_an_operand_type: diag(9040, 1 /* Error */, "keyof_type_must_have_an_operand_type_9040", "`keyof` type must have an operand type."),
7555
+ A_satisfies_keyof_computed_property_name_must_be_exactly_a_single_string_number_or_unique_symbol_literal_type: diag(9041, 1 /* Error */, "A_satisfies_keyof_computed_property_name_must_be_exactly_a_single_string_number_or_unique_symbol_lit_9041", "A `satisfies keyof` computed property name must be exactly a single string, number, or unique symbol literal type."),
7554
7556
  JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
7555
7557
  JSX_elements_cannot_have_multiple_attributes_with_the_same_name: diag(17001, 1 /* Error */, "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", "JSX elements cannot have multiple attributes with the same name."),
7556
7558
  Expected_corresponding_JSX_closing_tag_for_0: diag(17002, 1 /* Error */, "Expected_corresponding_JSX_closing_tag_for_0_17002", "Expected corresponding JSX closing tag for '{0}'."),
@@ -19189,7 +19191,7 @@ function createNameResolver({
19189
19191
  }
19190
19192
  break;
19191
19193
  }
19192
- if (isSelfReferenceLocation(location, lastLocation)) {
19194
+ if (isSelfReferenceLocation(location)) {
19193
19195
  lastSelfReferenceLocation = location;
19194
19196
  }
19195
19197
  lastLocation = location;
@@ -19290,10 +19292,8 @@ function createNameResolver({
19290
19292
  }
19291
19293
  return !getImmediatelyInvokedFunctionExpression(location);
19292
19294
  }
19293
- function isSelfReferenceLocation(node, lastLocation) {
19295
+ function isSelfReferenceLocation(node) {
19294
19296
  switch (node.kind) {
19295
- case 169 /* Parameter */:
19296
- return !!lastLocation && lastLocation === node.name;
19297
19297
  case 262 /* FunctionDeclaration */:
19298
19298
  case 263 /* ClassDeclaration */:
19299
19299
  case 264 /* InterfaceDeclaration */:
@@ -19368,6 +19368,9 @@ function hasInferredType(node) {
19368
19368
  return false;
19369
19369
  }
19370
19370
  }
19371
+ function isSatisfiesKeyofExpression(node) {
19372
+ return node.kind === 238 /* SatisfiesExpression */ && node.type.kind === 143 /* KeyOfKeyword */ && isEntityNameExpression(node.expression);
19373
+ }
19371
19374
 
19372
19375
  // src/compiler/factory/baseNodeFactory.ts
19373
19376
  function createBaseNodeFactory() {
@@ -30554,7 +30557,8 @@ var Parser;
30554
30557
  function parseTypeOperator(operator) {
30555
30558
  const pos = getNodePos();
30556
30559
  parseExpected(operator);
30557
- return finishNode(factory2.createTypeOperatorNode(operator, parseTypeOperatorOrHigher()), pos);
30560
+ const arg = operator !== 143 /* KeyOfKeyword */ || isStartOfType() ? parseTypeOperatorOrHigher() : void 0;
30561
+ return finishNode(arg ? factory2.createTypeOperatorNode(operator, arg) : factory2.createKeywordTypeNode(143 /* KeyOfKeyword */), pos);
30558
30562
  }
30559
30563
  function tryParseConstraintOfInferType() {
30560
30564
  if (parseOptional(96 /* ExtendsKeyword */)) {
@@ -49161,7 +49165,7 @@ function createTypeChecker(host) {
49161
49165
  }
49162
49166
  function getMeaningOfEntityNameReference(entityName) {
49163
49167
  let meaning;
49164
- if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */ || entityName.parent.kind === 182 /* TypePredicate */ && entityName.parent.parameterName === entityName) {
49168
+ if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */ || entityName.parent.kind === 182 /* TypePredicate */ && entityName.parent.parameterName === entityName || isSatisfiesKeyofExpression(entityName.parent)) {
49165
49169
  meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
49166
49170
  } else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */ || entityName.parent.kind === 166 /* QualifiedName */ && entityName.parent.left === entityName || entityName.parent.kind === 211 /* PropertyAccessExpression */ && entityName.parent.expression === entityName || entityName.parent.kind === 212 /* ElementAccessExpression */ && entityName.parent.expression === entityName) {
49167
49171
  meaning = 1920 /* Namespace */;
@@ -50274,7 +50278,7 @@ function createTypeChecker(host) {
50274
50278
  trackComputedName(name.argumentExpression, saveEnclosingDeclaration, context);
50275
50279
  }
50276
50280
  } else {
50277
- trackComputedName(decl.name.expression, saveEnclosingDeclaration, context);
50281
+ trackComputedName(isEntityNameExpression(decl.name.expression) ? decl.name.expression : decl.name.expression.expression, saveEnclosingDeclaration, context);
50278
50282
  }
50279
50283
  }
50280
50284
  } else {
@@ -50771,7 +50775,7 @@ function createTypeChecker(host) {
50771
50775
  return elideInitializerAndSetEmitFlags(node);
50772
50776
  function elideInitializerAndSetEmitFlags(node2) {
50773
50777
  if (context.tracker.canTrackSymbol && isComputedPropertyName(node2) && isLateBindableName(node2)) {
50774
- trackComputedName(node2.expression, context.enclosingDeclaration, context);
50778
+ trackComputedName(isEntityNameExpression(node2.expression) ? node2.expression : node2.expression.expression, context.enclosingDeclaration, context);
50775
50779
  }
50776
50780
  let visited = visitEachChild(
50777
50781
  node2,
@@ -55721,7 +55725,10 @@ function createTypeChecker(host) {
55721
55725
  if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
55722
55726
  return false;
55723
55727
  }
55724
- const expr = isComputedPropertyName(node) ? node.expression : node.argumentExpression;
55728
+ let expr = isComputedPropertyName(node) ? node.expression : node.argumentExpression;
55729
+ if (isSatisfiesExpression(expr) && expr.type.kind === 143 /* KeyOfKeyword */) {
55730
+ expr = expr.expression;
55731
+ }
55725
55732
  return isEntityNameExpression(expr) && isTypeUsableAsPropertyName(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(expr));
55726
55733
  }
55727
55734
  function isLateBoundName(name) {
@@ -61087,6 +61094,13 @@ function createTypeChecker(host) {
61087
61094
  type.escapedName = `__@${type.symbol.escapedName}@${getSymbolId(type.symbol)}`;
61088
61095
  return type;
61089
61096
  }
61097
+ function getUniqueESSymbolTypeForSymbol(symbol) {
61098
+ const links = getSymbolLinks(symbol);
61099
+ if (!links.uniqueESSymbolType) {
61100
+ links.uniqueESSymbolType = createUniqueESSymbolType(symbol);
61101
+ }
61102
+ return links.uniqueESSymbolType;
61103
+ }
61090
61104
  function getESSymbolLikeTypeForNode(node) {
61091
61105
  if (isInJSFile(node) && isJSDocTypeExpression(node)) {
61092
61106
  const host2 = getJSDocHost(node);
@@ -61097,8 +61111,7 @@ function createTypeChecker(host) {
61097
61111
  if (isValidESSymbolDeclaration(node)) {
61098
61112
  const symbol = isCommonJsExportPropertyAssignment(node) ? getSymbolOfNode(node.left) : getSymbolOfNode(node);
61099
61113
  if (symbol) {
61100
- const links = getSymbolLinks(symbol);
61101
- return links.uniqueESSymbolType || (links.uniqueESSymbolType = createUniqueESSymbolType(symbol));
61114
+ return getUniqueESSymbolTypeForSymbol(symbol);
61102
61115
  }
61103
61116
  }
61104
61117
  return esSymbolType;
@@ -61166,6 +61179,12 @@ function createTypeChecker(host) {
61166
61179
  !!node.questionToken
61167
61180
  ));
61168
61181
  }
61182
+ function getTypeFromKeyofKeywordTypeNode(node) {
61183
+ if (!isSatisfiesExpression(node.parent) || !isComputedPropertyName(node.parent.parent)) {
61184
+ error(node, Diagnostics.keyof_type_must_have_an_operand_type);
61185
+ }
61186
+ return stringNumberSymbolType;
61187
+ }
61169
61188
  function getTypeFromTypeNode(node) {
61170
61189
  return getConditionalFlowTypeOfType(getTypeFromTypeNodeWorker(node), node);
61171
61190
  }
@@ -61261,6 +61280,8 @@ function createTypeChecker(host) {
61261
61280
  case 211 /* PropertyAccessExpression */:
61262
61281
  const symbol = getSymbolAtLocation(node);
61263
61282
  return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType;
61283
+ case 143 /* KeyOfKeyword */:
61284
+ return getTypeFromKeyofKeywordTypeNode(node);
61264
61285
  default:
61265
61286
  return errorType;
61266
61287
  }
@@ -73445,7 +73466,20 @@ function createTypeChecker(host) {
73445
73466
  }
73446
73467
  }
73447
73468
  const indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, accessFlags, node) || errorType;
73448
- return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node);
73469
+ const result = checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node);
73470
+ if (!isErrorType(result)) {
73471
+ return result;
73472
+ }
73473
+ if (isEntityNameExpression(indexExpression)) {
73474
+ const fallback = getResolvedEntityNameUniqueSymbolType(indexExpression);
73475
+ if (fallback) {
73476
+ const indexedAccessType2 = getIndexedAccessTypeOrUndefined(objectType, fallback, accessFlags) || errorType;
73477
+ if (!isErrorType(indexedAccessType2) && !(indexedAccessType2.flags & 8388608 /* IndexedAccess */ && indexedAccessType2.objectType === objectType && indexedAccessType2.indexType === fallback)) {
73478
+ return getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType2, indexExpression, checkMode);
73479
+ }
73480
+ }
73481
+ }
73482
+ return result;
73449
73483
  }
73450
73484
  function callLikeExpressionMayHaveTypeArguments(node) {
73451
73485
  return isCallOrNewExpression(node) || isTaggedTemplateExpression(node) || isJsxOpeningLikeElement(node);
@@ -75693,13 +75727,49 @@ function createTypeChecker(host) {
75693
75727
  checkSourceElement(node.type);
75694
75728
  return checkSatisfiesExpressionWorker(node.expression, node.type);
75695
75729
  }
75730
+ function getResolvedEntityNameUniqueSymbolType(expression) {
75731
+ const links = getNodeLinks(expression);
75732
+ if (!links.uniqueSymbollFallback) {
75733
+ let resolved = resolveEntityName(
75734
+ expression,
75735
+ 111551 /* Value */ | 1048576 /* ExportValue */,
75736
+ /*ignoreErrors*/
75737
+ true
75738
+ );
75739
+ if (!resolved || resolved === unknownSymbol) {
75740
+ resolved = resolveEntityName(
75741
+ expression,
75742
+ 111551 /* Value */ | 1048576 /* ExportValue */,
75743
+ /*ignoreErrors*/
75744
+ true,
75745
+ /*dontResolveAlias*/
75746
+ true
75747
+ );
75748
+ }
75749
+ if (resolved) {
75750
+ links.uniqueSymbollFallback = getUniqueESSymbolTypeForSymbol(resolved);
75751
+ } else {
75752
+ links.uniqueSymbollFallback = false;
75753
+ }
75754
+ }
75755
+ return links.uniqueSymbollFallback || void 0;
75756
+ }
75696
75757
  function checkSatisfiesExpressionWorker(expression, target, checkMode) {
75697
75758
  const exprType = checkExpression(expression, checkMode);
75759
+ const errorNode = findAncestor(target.parent, (n) => n.kind === 238 /* SatisfiesExpression */ || n.kind === 350 /* JSDocSatisfiesTag */);
75760
+ if (target.kind === 143 /* KeyOfKeyword */ && isComputedPropertyName(expression.parent.parent)) {
75761
+ if (!(exprType.flags & 8576 /* StringOrNumberLiteralOrUnique */)) {
75762
+ error(expression, Diagnostics.A_satisfies_keyof_computed_property_name_must_be_exactly_a_single_string_number_or_unique_symbol_literal_type);
75763
+ if (isEntityNameExpression(expression)) {
75764
+ return getResolvedEntityNameUniqueSymbolType(expression) || exprType;
75765
+ }
75766
+ }
75767
+ return exprType;
75768
+ }
75698
75769
  const targetType = getTypeFromTypeNode(target);
75699
75770
  if (isErrorType(targetType)) {
75700
75771
  return targetType;
75701
75772
  }
75702
- const errorNode = findAncestor(target.parent, (n) => n.kind === 238 /* SatisfiesExpression */ || n.kind === 350 /* JSDocSatisfiesTag */);
75703
75773
  checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, errorNode, expression, Diagnostics.Type_0_does_not_satisfy_the_expected_type_1);
75704
75774
  return exprType;
75705
75775
  }
@@ -111525,7 +111595,7 @@ function transformDeclarations(context) {
111525
111595
  if (isDeclarationAndNotVisible(input)) return;
111526
111596
  if (hasDynamicName(input)) {
111527
111597
  if (isolatedDeclarations) {
111528
- if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression)) {
111598
+ if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression) && !isSatisfiesKeyofExpression(input.name.expression)) {
111529
111599
  if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
111530
111600
  context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
111531
111601
  return;
@@ -111537,7 +111607,7 @@ function transformDeclarations(context) {
111537
111607
  return;
111538
111608
  }
111539
111609
  }
111540
- } else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
111610
+ } else if (!resolver.isLateBound(getParseTreeNode(input)) || !(isEntityNameExpression(input.name.expression) || isSatisfiesKeyofExpression(input.name.expression))) {
111541
111611
  return;
111542
111612
  }
111543
111613
  }
@@ -111808,7 +111878,10 @@ function transformDeclarations(context) {
111808
111878
  return cleanup(visitEachChild(input, visitDeclarationSubtree, context));
111809
111879
  function cleanup(returnValue) {
111810
111880
  if (returnValue && canProduceDiagnostic && hasDynamicName(input)) {
111811
- checkName(input);
111881
+ const updated = checkName(input, returnValue);
111882
+ if (updated) {
111883
+ returnValue = updated;
111884
+ }
111812
111885
  }
111813
111886
  if (isEnclosingDeclaration(input)) {
111814
111887
  enclosingDeclaration = previousEnclosingDeclaration;
@@ -112317,7 +112390,7 @@ function transformDeclarations(context) {
112317
112390
  }
112318
112391
  }
112319
112392
  }
112320
- function checkName(node) {
112393
+ function checkName(node, returnValue) {
112321
112394
  let oldDiag;
112322
112395
  if (!suppressNewDiagnosticContexts) {
112323
112396
  oldDiag = getSymbolAccessibilityDiagnostic;
@@ -112327,11 +112400,21 @@ function transformDeclarations(context) {
112327
112400
  Debug.assert(hasDynamicName(node));
112328
112401
  const decl = node;
112329
112402
  const entityName = decl.name.expression;
112330
- checkEntityNameVisibility(entityName, enclosingDeclaration);
112403
+ const nameExpr = isEntityNameExpression(entityName) ? entityName : entityName.expression;
112404
+ checkEntityNameVisibility(nameExpr, enclosingDeclaration);
112405
+ let result = returnValue;
112406
+ if (returnValue && nameExpr !== entityName) {
112407
+ const updated = factory2.updateComputedPropertyName(decl.name, nameExpr);
112408
+ result = factory2.cloneNode(returnValue);
112409
+ result.name = updated;
112410
+ }
112331
112411
  if (!suppressNewDiagnosticContexts) {
112332
112412
  getSymbolAccessibilityDiagnostic = oldDiag;
112333
112413
  }
112334
112414
  errorNameNode = void 0;
112415
+ if (result !== returnValue) {
112416
+ return result;
112417
+ }
112335
112418
  }
112336
112419
  function shouldStripInternal(node) {
112337
112420
  return !!stripInternal && !!node && isInternalDeclaration(node, currentSourceFile);
@@ -4190,7 +4190,7 @@ declare namespace ts {
4190
4190
  | SyntaxKind.WithKeyword
4191
4191
  | SyntaxKind.YieldKeyword;
4192
4192
  type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword;
4193
- type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword;
4193
+ type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword | SyntaxKind.KeyOfKeyword;
4194
4194
  type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind;
4195
4195
  type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken;
4196
4196
  type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.GreaterThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.Unknown | KeywordSyntaxKind;
package/lib/typescript.js CHANGED
@@ -1751,6 +1751,7 @@ __export(typescript_exports, {
1751
1751
  isRootedDiskPath: () => isRootedDiskPath,
1752
1752
  isSameEntityName: () => isSameEntityName,
1753
1753
  isSatisfiesExpression: () => isSatisfiesExpression,
1754
+ isSatisfiesKeyofExpression: () => isSatisfiesKeyofExpression,
1754
1755
  isScopeMarker: () => isScopeMarker,
1755
1756
  isSemicolonClassElement: () => isSemicolonClassElement,
1756
1757
  isSetAccessor: () => isSetAccessor,
@@ -2375,7 +2376,7 @@ module.exports = __toCommonJS(typescript_exports);
2375
2376
 
2376
2377
  // src/compiler/corePublic.ts
2377
2378
  var versionMajorMinor = "5.6";
2378
- var version = `${versionMajorMinor}.0-insiders.20240610`;
2379
+ var version = `${versionMajorMinor}.0-insiders.20240611`;
2379
2380
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2380
2381
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2381
2382
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -11138,6 +11139,8 @@ var Diagnostics = {
11138
11139
  Default_exports_can_t_be_inferred_with_isolatedDeclarations: diag(9037, 1 /* Error */, "Default_exports_can_t_be_inferred_with_isolatedDeclarations_9037", "Default exports can't be inferred with --isolatedDeclarations."),
11139
11140
  Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations: diag(9038, 1 /* Error */, "Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations_9038", "Computed property names on class or object literals cannot be inferred with --isolatedDeclarations."),
11140
11141
  Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations: diag(9039, 1 /* Error */, "Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations_9039", "Type containing private name '{0}' can't be used with --isolatedDeclarations."),
11142
+ keyof_type_must_have_an_operand_type: diag(9040, 1 /* Error */, "keyof_type_must_have_an_operand_type_9040", "`keyof` type must have an operand type."),
11143
+ A_satisfies_keyof_computed_property_name_must_be_exactly_a_single_string_number_or_unique_symbol_literal_type: diag(9041, 1 /* Error */, "A_satisfies_keyof_computed_property_name_must_be_exactly_a_single_string_number_or_unique_symbol_lit_9041", "A `satisfies keyof` computed property name must be exactly a single string, number, or unique symbol literal type."),
11141
11144
  JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
11142
11145
  JSX_elements_cannot_have_multiple_attributes_with_the_same_name: diag(17001, 1 /* Error */, "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", "JSX elements cannot have multiple attributes with the same name."),
11143
11146
  Expected_corresponding_JSX_closing_tag_for_0: diag(17002, 1 /* Error */, "Expected_corresponding_JSX_closing_tag_for_0_17002", "Expected corresponding JSX closing tag for '{0}'."),
@@ -23436,7 +23439,7 @@ function createNameResolver({
23436
23439
  }
23437
23440
  break;
23438
23441
  }
23439
- if (isSelfReferenceLocation(location, lastLocation)) {
23442
+ if (isSelfReferenceLocation(location)) {
23440
23443
  lastSelfReferenceLocation = location;
23441
23444
  }
23442
23445
  lastLocation = location;
@@ -23537,10 +23540,8 @@ function createNameResolver({
23537
23540
  }
23538
23541
  return !getImmediatelyInvokedFunctionExpression(location);
23539
23542
  }
23540
- function isSelfReferenceLocation(node, lastLocation) {
23543
+ function isSelfReferenceLocation(node) {
23541
23544
  switch (node.kind) {
23542
- case 169 /* Parameter */:
23543
- return !!lastLocation && lastLocation === node.name;
23544
23545
  case 262 /* FunctionDeclaration */:
23545
23546
  case 263 /* ClassDeclaration */:
23546
23547
  case 264 /* InterfaceDeclaration */:
@@ -23615,6 +23616,9 @@ function hasInferredType(node) {
23615
23616
  return false;
23616
23617
  }
23617
23618
  }
23619
+ function isSatisfiesKeyofExpression(node) {
23620
+ return node.kind === 238 /* SatisfiesExpression */ && node.type.kind === 143 /* KeyOfKeyword */ && isEntityNameExpression(node.expression);
23621
+ }
23618
23622
 
23619
23623
  // src/compiler/factory/baseNodeFactory.ts
23620
23624
  function createBaseNodeFactory() {
@@ -34978,7 +34982,8 @@ var Parser;
34978
34982
  function parseTypeOperator(operator) {
34979
34983
  const pos = getNodePos();
34980
34984
  parseExpected(operator);
34981
- return finishNode(factory2.createTypeOperatorNode(operator, parseTypeOperatorOrHigher()), pos);
34985
+ const arg = operator !== 143 /* KeyOfKeyword */ || isStartOfType() ? parseTypeOperatorOrHigher() : void 0;
34986
+ return finishNode(arg ? factory2.createTypeOperatorNode(operator, arg) : factory2.createKeywordTypeNode(143 /* KeyOfKeyword */), pos);
34982
34987
  }
34983
34988
  function tryParseConstraintOfInferType() {
34984
34989
  if (parseOptional(96 /* ExtendsKeyword */)) {
@@ -53934,7 +53939,7 @@ function createTypeChecker(host) {
53934
53939
  }
53935
53940
  function getMeaningOfEntityNameReference(entityName) {
53936
53941
  let meaning;
53937
- if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */ || entityName.parent.kind === 182 /* TypePredicate */ && entityName.parent.parameterName === entityName) {
53942
+ if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */ || entityName.parent.kind === 182 /* TypePredicate */ && entityName.parent.parameterName === entityName || isSatisfiesKeyofExpression(entityName.parent)) {
53938
53943
  meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
53939
53944
  } else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */ || entityName.parent.kind === 166 /* QualifiedName */ && entityName.parent.left === entityName || entityName.parent.kind === 211 /* PropertyAccessExpression */ && entityName.parent.expression === entityName || entityName.parent.kind === 212 /* ElementAccessExpression */ && entityName.parent.expression === entityName) {
53940
53945
  meaning = 1920 /* Namespace */;
@@ -55047,7 +55052,7 @@ function createTypeChecker(host) {
55047
55052
  trackComputedName(name.argumentExpression, saveEnclosingDeclaration, context);
55048
55053
  }
55049
55054
  } else {
55050
- trackComputedName(decl.name.expression, saveEnclosingDeclaration, context);
55055
+ trackComputedName(isEntityNameExpression(decl.name.expression) ? decl.name.expression : decl.name.expression.expression, saveEnclosingDeclaration, context);
55051
55056
  }
55052
55057
  }
55053
55058
  } else {
@@ -55544,7 +55549,7 @@ function createTypeChecker(host) {
55544
55549
  return elideInitializerAndSetEmitFlags(node);
55545
55550
  function elideInitializerAndSetEmitFlags(node2) {
55546
55551
  if (context.tracker.canTrackSymbol && isComputedPropertyName(node2) && isLateBindableName(node2)) {
55547
- trackComputedName(node2.expression, context.enclosingDeclaration, context);
55552
+ trackComputedName(isEntityNameExpression(node2.expression) ? node2.expression : node2.expression.expression, context.enclosingDeclaration, context);
55548
55553
  }
55549
55554
  let visited = visitEachChild(
55550
55555
  node2,
@@ -60494,7 +60499,10 @@ function createTypeChecker(host) {
60494
60499
  if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
60495
60500
  return false;
60496
60501
  }
60497
- const expr = isComputedPropertyName(node) ? node.expression : node.argumentExpression;
60502
+ let expr = isComputedPropertyName(node) ? node.expression : node.argumentExpression;
60503
+ if (isSatisfiesExpression(expr) && expr.type.kind === 143 /* KeyOfKeyword */) {
60504
+ expr = expr.expression;
60505
+ }
60498
60506
  return isEntityNameExpression(expr) && isTypeUsableAsPropertyName(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(expr));
60499
60507
  }
60500
60508
  function isLateBoundName(name) {
@@ -65860,6 +65868,13 @@ function createTypeChecker(host) {
65860
65868
  type.escapedName = `__@${type.symbol.escapedName}@${getSymbolId(type.symbol)}`;
65861
65869
  return type;
65862
65870
  }
65871
+ function getUniqueESSymbolTypeForSymbol(symbol) {
65872
+ const links = getSymbolLinks(symbol);
65873
+ if (!links.uniqueESSymbolType) {
65874
+ links.uniqueESSymbolType = createUniqueESSymbolType(symbol);
65875
+ }
65876
+ return links.uniqueESSymbolType;
65877
+ }
65863
65878
  function getESSymbolLikeTypeForNode(node) {
65864
65879
  if (isInJSFile(node) && isJSDocTypeExpression(node)) {
65865
65880
  const host2 = getJSDocHost(node);
@@ -65870,8 +65885,7 @@ function createTypeChecker(host) {
65870
65885
  if (isValidESSymbolDeclaration(node)) {
65871
65886
  const symbol = isCommonJsExportPropertyAssignment(node) ? getSymbolOfNode(node.left) : getSymbolOfNode(node);
65872
65887
  if (symbol) {
65873
- const links = getSymbolLinks(symbol);
65874
- return links.uniqueESSymbolType || (links.uniqueESSymbolType = createUniqueESSymbolType(symbol));
65888
+ return getUniqueESSymbolTypeForSymbol(symbol);
65875
65889
  }
65876
65890
  }
65877
65891
  return esSymbolType;
@@ -65939,6 +65953,12 @@ function createTypeChecker(host) {
65939
65953
  !!node.questionToken
65940
65954
  ));
65941
65955
  }
65956
+ function getTypeFromKeyofKeywordTypeNode(node) {
65957
+ if (!isSatisfiesExpression(node.parent) || !isComputedPropertyName(node.parent.parent)) {
65958
+ error2(node, Diagnostics.keyof_type_must_have_an_operand_type);
65959
+ }
65960
+ return stringNumberSymbolType;
65961
+ }
65942
65962
  function getTypeFromTypeNode(node) {
65943
65963
  return getConditionalFlowTypeOfType(getTypeFromTypeNodeWorker(node), node);
65944
65964
  }
@@ -66034,6 +66054,8 @@ function createTypeChecker(host) {
66034
66054
  case 211 /* PropertyAccessExpression */:
66035
66055
  const symbol = getSymbolAtLocation(node);
66036
66056
  return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType;
66057
+ case 143 /* KeyOfKeyword */:
66058
+ return getTypeFromKeyofKeywordTypeNode(node);
66037
66059
  default:
66038
66060
  return errorType;
66039
66061
  }
@@ -78218,7 +78240,20 @@ function createTypeChecker(host) {
78218
78240
  }
78219
78241
  }
78220
78242
  const indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, accessFlags, node) || errorType;
78221
- return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node);
78243
+ const result = checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node);
78244
+ if (!isErrorType(result)) {
78245
+ return result;
78246
+ }
78247
+ if (isEntityNameExpression(indexExpression)) {
78248
+ const fallback = getResolvedEntityNameUniqueSymbolType(indexExpression);
78249
+ if (fallback) {
78250
+ const indexedAccessType2 = getIndexedAccessTypeOrUndefined(objectType, fallback, accessFlags) || errorType;
78251
+ if (!isErrorType(indexedAccessType2) && !(indexedAccessType2.flags & 8388608 /* IndexedAccess */ && indexedAccessType2.objectType === objectType && indexedAccessType2.indexType === fallback)) {
78252
+ return getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType2, indexExpression, checkMode);
78253
+ }
78254
+ }
78255
+ }
78256
+ return result;
78222
78257
  }
78223
78258
  function callLikeExpressionMayHaveTypeArguments(node) {
78224
78259
  return isCallOrNewExpression(node) || isTaggedTemplateExpression(node) || isJsxOpeningLikeElement(node);
@@ -80466,13 +80501,49 @@ function createTypeChecker(host) {
80466
80501
  checkSourceElement(node.type);
80467
80502
  return checkSatisfiesExpressionWorker(node.expression, node.type);
80468
80503
  }
80504
+ function getResolvedEntityNameUniqueSymbolType(expression) {
80505
+ const links = getNodeLinks(expression);
80506
+ if (!links.uniqueSymbollFallback) {
80507
+ let resolved = resolveEntityName(
80508
+ expression,
80509
+ 111551 /* Value */ | 1048576 /* ExportValue */,
80510
+ /*ignoreErrors*/
80511
+ true
80512
+ );
80513
+ if (!resolved || resolved === unknownSymbol) {
80514
+ resolved = resolveEntityName(
80515
+ expression,
80516
+ 111551 /* Value */ | 1048576 /* ExportValue */,
80517
+ /*ignoreErrors*/
80518
+ true,
80519
+ /*dontResolveAlias*/
80520
+ true
80521
+ );
80522
+ }
80523
+ if (resolved) {
80524
+ links.uniqueSymbollFallback = getUniqueESSymbolTypeForSymbol(resolved);
80525
+ } else {
80526
+ links.uniqueSymbollFallback = false;
80527
+ }
80528
+ }
80529
+ return links.uniqueSymbollFallback || void 0;
80530
+ }
80469
80531
  function checkSatisfiesExpressionWorker(expression, target, checkMode) {
80470
80532
  const exprType = checkExpression(expression, checkMode);
80533
+ const errorNode = findAncestor(target.parent, (n) => n.kind === 238 /* SatisfiesExpression */ || n.kind === 350 /* JSDocSatisfiesTag */);
80534
+ if (target.kind === 143 /* KeyOfKeyword */ && isComputedPropertyName(expression.parent.parent)) {
80535
+ if (!(exprType.flags & 8576 /* StringOrNumberLiteralOrUnique */)) {
80536
+ error2(expression, Diagnostics.A_satisfies_keyof_computed_property_name_must_be_exactly_a_single_string_number_or_unique_symbol_literal_type);
80537
+ if (isEntityNameExpression(expression)) {
80538
+ return getResolvedEntityNameUniqueSymbolType(expression) || exprType;
80539
+ }
80540
+ }
80541
+ return exprType;
80542
+ }
80471
80543
  const targetType = getTypeFromTypeNode(target);
80472
80544
  if (isErrorType(targetType)) {
80473
80545
  return targetType;
80474
80546
  }
80475
- const errorNode = findAncestor(target.parent, (n) => n.kind === 238 /* SatisfiesExpression */ || n.kind === 350 /* JSDocSatisfiesTag */);
80476
80547
  checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, errorNode, expression, Diagnostics.Type_0_does_not_satisfy_the_expected_type_1);
80477
80548
  return exprType;
80478
80549
  }
@@ -116480,7 +116551,7 @@ function transformDeclarations(context) {
116480
116551
  if (isDeclarationAndNotVisible(input)) return;
116481
116552
  if (hasDynamicName(input)) {
116482
116553
  if (isolatedDeclarations) {
116483
- if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression)) {
116554
+ if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression) && !isSatisfiesKeyofExpression(input.name.expression)) {
116484
116555
  if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
116485
116556
  context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
116486
116557
  return;
@@ -116492,7 +116563,7 @@ function transformDeclarations(context) {
116492
116563
  return;
116493
116564
  }
116494
116565
  }
116495
- } else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
116566
+ } else if (!resolver.isLateBound(getParseTreeNode(input)) || !(isEntityNameExpression(input.name.expression) || isSatisfiesKeyofExpression(input.name.expression))) {
116496
116567
  return;
116497
116568
  }
116498
116569
  }
@@ -116763,7 +116834,10 @@ function transformDeclarations(context) {
116763
116834
  return cleanup(visitEachChild(input, visitDeclarationSubtree, context));
116764
116835
  function cleanup(returnValue) {
116765
116836
  if (returnValue && canProduceDiagnostic && hasDynamicName(input)) {
116766
- checkName(input);
116837
+ const updated = checkName(input, returnValue);
116838
+ if (updated) {
116839
+ returnValue = updated;
116840
+ }
116767
116841
  }
116768
116842
  if (isEnclosingDeclaration(input)) {
116769
116843
  enclosingDeclaration = previousEnclosingDeclaration;
@@ -117272,7 +117346,7 @@ function transformDeclarations(context) {
117272
117346
  }
117273
117347
  }
117274
117348
  }
117275
- function checkName(node) {
117349
+ function checkName(node, returnValue) {
117276
117350
  let oldDiag;
117277
117351
  if (!suppressNewDiagnosticContexts) {
117278
117352
  oldDiag = getSymbolAccessibilityDiagnostic;
@@ -117282,11 +117356,21 @@ function transformDeclarations(context) {
117282
117356
  Debug.assert(hasDynamicName(node));
117283
117357
  const decl = node;
117284
117358
  const entityName = decl.name.expression;
117285
- checkEntityNameVisibility(entityName, enclosingDeclaration);
117359
+ const nameExpr = isEntityNameExpression(entityName) ? entityName : entityName.expression;
117360
+ checkEntityNameVisibility(nameExpr, enclosingDeclaration);
117361
+ let result = returnValue;
117362
+ if (returnValue && nameExpr !== entityName) {
117363
+ const updated = factory2.updateComputedPropertyName(decl.name, nameExpr);
117364
+ result = factory2.cloneNode(returnValue);
117365
+ result.name = updated;
117366
+ }
117286
117367
  if (!suppressNewDiagnosticContexts) {
117287
117368
  getSymbolAccessibilityDiagnostic = oldDiag;
117288
117369
  }
117289
117370
  errorNameNode = void 0;
117371
+ if (result !== returnValue) {
117372
+ return result;
117373
+ }
117290
117374
  }
117291
117375
  function shouldStripInternal(node) {
117292
117376
  return !!stripInternal && !!node && isInternalDeclaration(node, currentSourceFile);
@@ -180253,6 +180337,7 @@ __export(ts_exports2, {
180253
180337
  isRootedDiskPath: () => isRootedDiskPath,
180254
180338
  isSameEntityName: () => isSameEntityName,
180255
180339
  isSatisfiesExpression: () => isSatisfiesExpression,
180340
+ isSatisfiesKeyofExpression: () => isSatisfiesKeyofExpression,
180256
180341
  isScopeMarker: () => isScopeMarker,
180257
180342
  isSemicolonClassElement: () => isSemicolonClassElement,
180258
180343
  isSetAccessor: () => isSetAccessor,
@@ -194689,6 +194774,7 @@ if (typeof console !== "undefined") {
194689
194774
  isRootedDiskPath,
194690
194775
  isSameEntityName,
194691
194776
  isSatisfiesExpression,
194777
+ isSatisfiesKeyofExpression,
194692
194778
  isScopeMarker,
194693
194779
  isSemicolonClassElement,
194694
194780
  isSetAccessor,
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.6.0-pr-58514-9",
5
+ "version": "5.6.0-pr-58829-3",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [