typescript 5.0.0-dev.20230215 → 5.0.0-dev.20230217

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
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.0";
26
- var version = `${versionMajorMinor}.0-dev.20230215`;
26
+ var version = `${versionMajorMinor}.0-dev.20230217`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -24988,7 +24988,7 @@ function canHaveIllegalDecorators(node) {
24988
24988
  }
24989
24989
  function canHaveIllegalModifiers(node) {
24990
24990
  const kind = node.kind;
24991
- return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 181 /* FunctionType */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
24991
+ return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
24992
24992
  }
24993
24993
  function isQuestionOrExclamationToken(node) {
24994
24994
  return isQuestionToken(node) || isExclamationToken(node);
@@ -26988,7 +26988,6 @@ var Parser;
26988
26988
  return canFollowExportModifier();
26989
26989
  case 88 /* DefaultKeyword */:
26990
26990
  return nextTokenCanFollowDefaultKeyword();
26991
- case 127 /* AccessorKeyword */:
26992
26991
  case 124 /* StaticKeyword */:
26993
26992
  case 137 /* GetKeyword */:
26994
26993
  case 151 /* SetKeyword */:
@@ -28281,6 +28280,7 @@ var Parser;
28281
28280
  const hasJSDoc = hasPrecedingJSDocComment();
28282
28281
  const modifiers = parseModifiersForConstructorType();
28283
28282
  const isConstructorType = parseOptional(103 /* NewKeyword */);
28283
+ Debug.assert(!modifiers || isConstructorType, "Per isStartOfFunctionOrConstructorType, a function type cannot have modifiers.");
28284
28284
  const typeParameters = parseTypeParameters();
28285
28285
  const parameters = parseParameters(4 /* Type */);
28286
28286
  const type = parseReturnType(
@@ -28289,8 +28289,6 @@ var Parser;
28289
28289
  false
28290
28290
  );
28291
28291
  const node = isConstructorType ? factory2.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory2.createFunctionTypeNode(typeParameters, parameters, type);
28292
- if (!isConstructorType)
28293
- node.modifiers = modifiers;
28294
28292
  return withJSDoc(finishNode(node, pos), hasJSDoc);
28295
28293
  }
28296
28294
  function parseKeywordAndNoDot() {
@@ -42586,6 +42584,7 @@ function createTypeChecker(host) {
42586
42584
  let inlineLevel = 0;
42587
42585
  let currentNode;
42588
42586
  let varianceTypeParameter;
42587
+ let isInferencePartiallyBlocked = false;
42589
42588
  const emptySymbols = createSymbolTable();
42590
42589
  const arrayVariances = [1 /* Covariant */];
42591
42590
  const compilerOptions = host.getCompilerOptions();
@@ -43017,7 +43016,9 @@ function createTypeChecker(host) {
43017
43016
  toMarkSkip = toMarkSkip.parent;
43018
43017
  } while (toMarkSkip && toMarkSkip !== containingCall);
43019
43018
  }
43019
+ isInferencePartiallyBlocked = true;
43020
43020
  const result = runWithoutResolvedSignatureCaching(node, fn);
43021
+ isInferencePartiallyBlocked = false;
43021
43022
  if (containingCall) {
43022
43023
  let toMarkSkip = node;
43023
43024
  do {
@@ -53063,6 +53064,7 @@ function createTypeChecker(host) {
53063
53064
  const typeParameter = getTypeParameterFromMappedType(type);
53064
53065
  const constraintType = getConstraintTypeFromMappedType(type);
53065
53066
  const nameType = getNameTypeFromMappedType(type.target || type);
53067
+ const isFilteringMappedType = nameType && isTypeAssignableTo(nameType, typeParameter);
53066
53068
  const templateType = getTemplateTypeFromMappedType(type.target || type);
53067
53069
  const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
53068
53070
  const templateModifiers = getMappedTypeModifiers(type);
@@ -53100,7 +53102,7 @@ function createTypeChecker(host) {
53100
53102
  prop.links.keyType = keyType;
53101
53103
  if (modifiersProp) {
53102
53104
  prop.links.syntheticOrigin = modifiersProp;
53103
- prop.declarations = nameType ? void 0 : modifiersProp.declarations;
53105
+ prop.declarations = !nameType || isFilteringMappedType ? modifiersProp.declarations : void 0;
53104
53106
  }
53105
53107
  members.set(propName, prop);
53106
53108
  }
@@ -61832,6 +61834,9 @@ function createTypeChecker(host) {
61832
61834
  const key = `B${getTypeId(type)}`;
61833
61835
  return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
61834
61836
  }
61837
+ function getBaseTypeOfLiteralTypeForComparison(type) {
61838
+ return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
61839
+ }
61835
61840
  function getWidenedLiteralType(type) {
61836
61841
  return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
61837
61842
  }
@@ -69656,7 +69661,7 @@ function createTypeChecker(host) {
69656
69661
  const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
69657
69662
  const isDecorator2 = node.kind === 167 /* Decorator */;
69658
69663
  const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
69659
- const reportErrors2 = !candidatesOutArray;
69664
+ const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
69660
69665
  let typeArguments;
69661
69666
  if (!isDecorator2 && !isSuperCall(node)) {
69662
69667
  typeArguments = node.typeArguments;
@@ -72897,8 +72902,8 @@ function createTypeChecker(host) {
72897
72902
  case 32 /* LessThanEqualsToken */:
72898
72903
  case 33 /* GreaterThanEqualsToken */:
72899
72904
  if (checkForDisallowedESSymbolOperand(operator)) {
72900
- leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left));
72901
- rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right));
72905
+ leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left));
72906
+ rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right));
72902
72907
  reportOperatorErrorUnless((left2, right2) => {
72903
72908
  if (isTypeAny(left2) || isTypeAny(right2)) {
72904
72909
  return true;
@@ -74734,6 +74739,17 @@ function createTypeChecker(host) {
74734
74739
  lastSeenNonAmbientDeclaration = node;
74735
74740
  }
74736
74741
  }
74742
+ if (isInJSFile(current) && isFunctionLike(current) && current.jsDoc) {
74743
+ for (const node2 of current.jsDoc) {
74744
+ if (node2.tags) {
74745
+ for (const tag of node2.tags) {
74746
+ if (isJSDocOverloadTag(tag)) {
74747
+ hasOverloads = true;
74748
+ }
74749
+ }
74750
+ }
74751
+ }
74752
+ }
74737
74753
  }
74738
74754
  }
74739
74755
  if (multipleConstructorImplementation) {
@@ -74771,8 +74787,9 @@ function createTypeChecker(host) {
74771
74787
  const bodySignature = getSignatureFromDeclaration(bodyDeclaration);
74772
74788
  for (const signature of signatures) {
74773
74789
  if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
74790
+ const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
74774
74791
  addRelatedInfo(
74775
- error(signature.declaration, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
74792
+ error(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
74776
74793
  createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
74777
74794
  );
74778
74795
  break;
@@ -81388,7 +81405,6 @@ function createTypeChecker(host) {
81388
81405
  case 299 /* PropertyAssignment */:
81389
81406
  case 300 /* ShorthandPropertyAssignment */:
81390
81407
  case 267 /* NamespaceExportDeclaration */:
81391
- case 181 /* FunctionType */:
81392
81408
  case 279 /* MissingDeclaration */:
81393
81409
  return find(node.modifiers, isModifier);
81394
81410
  default:
@@ -87635,7 +87651,16 @@ function transformClassFields(context) {
87635
87651
  visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
87636
87652
  );
87637
87653
  }
87638
- return visitEachChild(node, visitor, context);
87654
+ return factory2.updatePropertyDeclaration(
87655
+ node,
87656
+ visitNodes2(node.modifiers, modifierVisitor, isModifier),
87657
+ visitNode(node.name, propertyNameVisitor, isPropertyName),
87658
+ /*questionOrExclamationToken*/
87659
+ void 0,
87660
+ /*type*/
87661
+ void 0,
87662
+ visitNode(node.initializer, visitor, isExpression)
87663
+ );
87639
87664
  }
87640
87665
  function transformPublicFieldInitializer(node) {
87641
87666
  if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
package/lib/tsserver.js CHANGED
@@ -1351,6 +1351,7 @@ __export(server_exports, {
1351
1351
  isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
1352
1352
  isGlobalDeclaration: () => isGlobalDeclaration,
1353
1353
  isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
1354
+ isGrammarError: () => isGrammarError,
1354
1355
  isHeritageClause: () => isHeritageClause,
1355
1356
  isHoistedFunction: () => isHoistedFunction,
1356
1357
  isHoistedVariableStatement: () => isHoistedVariableStatement,
@@ -2287,7 +2288,7 @@ module.exports = __toCommonJS(server_exports);
2287
2288
 
2288
2289
  // src/compiler/corePublic.ts
2289
2290
  var versionMajorMinor = "5.0";
2290
- var version = `${versionMajorMinor}.0-dev.20230215`;
2291
+ var version = `${versionMajorMinor}.0-dev.20230217`;
2291
2292
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2292
2293
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2293
2294
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -15193,6 +15194,36 @@ function nodeIsMissing(node) {
15193
15194
  function nodeIsPresent(node) {
15194
15195
  return !nodeIsMissing(node);
15195
15196
  }
15197
+ function isGrammarError(parent2, child) {
15198
+ if (isTypeParameterDeclaration(parent2))
15199
+ return child === parent2.expression;
15200
+ if (isClassStaticBlockDeclaration(parent2))
15201
+ return child === parent2.modifiers;
15202
+ if (isPropertySignature(parent2))
15203
+ return child === parent2.initializer;
15204
+ if (isPropertyDeclaration(parent2))
15205
+ return child === parent2.questionToken && isAutoAccessorPropertyDeclaration(parent2);
15206
+ if (isPropertyAssignment(parent2))
15207
+ return child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
15208
+ if (isShorthandPropertyAssignment(parent2))
15209
+ return child === parent2.equalsToken || child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
15210
+ if (isMethodDeclaration(parent2))
15211
+ return child === parent2.exclamationToken;
15212
+ if (isConstructorDeclaration(parent2))
15213
+ return child === parent2.typeParameters || child === parent2.type || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
15214
+ if (isGetAccessorDeclaration(parent2))
15215
+ return child === parent2.typeParameters || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
15216
+ if (isSetAccessorDeclaration(parent2))
15217
+ return child === parent2.typeParameters || child === parent2.type || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
15218
+ if (isNamespaceExportDeclaration(parent2))
15219
+ return child === parent2.modifiers || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
15220
+ return false;
15221
+ }
15222
+ function isGrammarErrorElement(nodeArray, child, isElement) {
15223
+ if (!nodeArray || isArray(child) || !isElement(child))
15224
+ return false;
15225
+ return contains(nodeArray, child);
15226
+ }
15196
15227
  function insertStatementsAfterPrologue(to, from, isPrologueDirective2) {
15197
15228
  if (from === void 0 || from.length === 0)
15198
15229
  return to;
@@ -29280,7 +29311,7 @@ function canHaveIllegalDecorators(node) {
29280
29311
  }
29281
29312
  function canHaveIllegalModifiers(node) {
29282
29313
  const kind = node.kind;
29283
- return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 181 /* FunctionType */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
29314
+ return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
29284
29315
  }
29285
29316
  function isQuestionOrExclamationToken(node) {
29286
29317
  return isQuestionToken(node) || isExclamationToken(node);
@@ -31303,7 +31334,6 @@ var Parser;
31303
31334
  return canFollowExportModifier();
31304
31335
  case 88 /* DefaultKeyword */:
31305
31336
  return nextTokenCanFollowDefaultKeyword();
31306
- case 127 /* AccessorKeyword */:
31307
31337
  case 124 /* StaticKeyword */:
31308
31338
  case 137 /* GetKeyword */:
31309
31339
  case 151 /* SetKeyword */:
@@ -32596,6 +32626,7 @@ var Parser;
32596
32626
  const hasJSDoc = hasPrecedingJSDocComment();
32597
32627
  const modifiers = parseModifiersForConstructorType();
32598
32628
  const isConstructorType = parseOptional(103 /* NewKeyword */);
32629
+ Debug.assert(!modifiers || isConstructorType, "Per isStartOfFunctionOrConstructorType, a function type cannot have modifiers.");
32599
32630
  const typeParameters = parseTypeParameters();
32600
32631
  const parameters = parseParameters(4 /* Type */);
32601
32632
  const type = parseReturnType(
@@ -32604,8 +32635,6 @@ var Parser;
32604
32635
  false
32605
32636
  );
32606
32637
  const node = isConstructorType ? factory2.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory2.createFunctionTypeNode(typeParameters, parameters, type);
32607
- if (!isConstructorType)
32608
- node.modifiers = modifiers;
32609
32638
  return withJSDoc(finishNode(node, pos), hasJSDoc);
32610
32639
  }
32611
32640
  function parseKeywordAndNoDot() {
@@ -47162,6 +47191,7 @@ function createTypeChecker(host) {
47162
47191
  let inlineLevel = 0;
47163
47192
  let currentNode;
47164
47193
  let varianceTypeParameter;
47194
+ let isInferencePartiallyBlocked = false;
47165
47195
  const emptySymbols = createSymbolTable();
47166
47196
  const arrayVariances = [1 /* Covariant */];
47167
47197
  const compilerOptions = host.getCompilerOptions();
@@ -47593,7 +47623,9 @@ function createTypeChecker(host) {
47593
47623
  toMarkSkip = toMarkSkip.parent;
47594
47624
  } while (toMarkSkip && toMarkSkip !== containingCall);
47595
47625
  }
47626
+ isInferencePartiallyBlocked = true;
47596
47627
  const result = runWithoutResolvedSignatureCaching(node, fn);
47628
+ isInferencePartiallyBlocked = false;
47597
47629
  if (containingCall) {
47598
47630
  let toMarkSkip = node;
47599
47631
  do {
@@ -57639,6 +57671,7 @@ function createTypeChecker(host) {
57639
57671
  const typeParameter = getTypeParameterFromMappedType(type);
57640
57672
  const constraintType = getConstraintTypeFromMappedType(type);
57641
57673
  const nameType = getNameTypeFromMappedType(type.target || type);
57674
+ const isFilteringMappedType = nameType && isTypeAssignableTo(nameType, typeParameter);
57642
57675
  const templateType = getTemplateTypeFromMappedType(type.target || type);
57643
57676
  const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
57644
57677
  const templateModifiers = getMappedTypeModifiers(type);
@@ -57676,7 +57709,7 @@ function createTypeChecker(host) {
57676
57709
  prop.links.keyType = keyType;
57677
57710
  if (modifiersProp) {
57678
57711
  prop.links.syntheticOrigin = modifiersProp;
57679
- prop.declarations = nameType ? void 0 : modifiersProp.declarations;
57712
+ prop.declarations = !nameType || isFilteringMappedType ? modifiersProp.declarations : void 0;
57680
57713
  }
57681
57714
  members.set(propName, prop);
57682
57715
  }
@@ -66408,6 +66441,9 @@ function createTypeChecker(host) {
66408
66441
  const key = `B${getTypeId(type)}`;
66409
66442
  return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
66410
66443
  }
66444
+ function getBaseTypeOfLiteralTypeForComparison(type) {
66445
+ return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
66446
+ }
66411
66447
  function getWidenedLiteralType(type) {
66412
66448
  return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
66413
66449
  }
@@ -74232,7 +74268,7 @@ function createTypeChecker(host) {
74232
74268
  const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
74233
74269
  const isDecorator2 = node.kind === 167 /* Decorator */;
74234
74270
  const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
74235
- const reportErrors2 = !candidatesOutArray;
74271
+ const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
74236
74272
  let typeArguments;
74237
74273
  if (!isDecorator2 && !isSuperCall(node)) {
74238
74274
  typeArguments = node.typeArguments;
@@ -77473,8 +77509,8 @@ function createTypeChecker(host) {
77473
77509
  case 32 /* LessThanEqualsToken */:
77474
77510
  case 33 /* GreaterThanEqualsToken */:
77475
77511
  if (checkForDisallowedESSymbolOperand(operator)) {
77476
- leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left));
77477
- rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right));
77512
+ leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left));
77513
+ rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right));
77478
77514
  reportOperatorErrorUnless((left2, right2) => {
77479
77515
  if (isTypeAny(left2) || isTypeAny(right2)) {
77480
77516
  return true;
@@ -79310,6 +79346,17 @@ function createTypeChecker(host) {
79310
79346
  lastSeenNonAmbientDeclaration = node;
79311
79347
  }
79312
79348
  }
79349
+ if (isInJSFile(current) && isFunctionLike(current) && current.jsDoc) {
79350
+ for (const node2 of current.jsDoc) {
79351
+ if (node2.tags) {
79352
+ for (const tag of node2.tags) {
79353
+ if (isJSDocOverloadTag(tag)) {
79354
+ hasOverloads = true;
79355
+ }
79356
+ }
79357
+ }
79358
+ }
79359
+ }
79313
79360
  }
79314
79361
  }
79315
79362
  if (multipleConstructorImplementation) {
@@ -79347,8 +79394,9 @@ function createTypeChecker(host) {
79347
79394
  const bodySignature = getSignatureFromDeclaration(bodyDeclaration);
79348
79395
  for (const signature of signatures) {
79349
79396
  if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
79397
+ const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
79350
79398
  addRelatedInfo(
79351
- error(signature.declaration, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
79399
+ error(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
79352
79400
  createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
79353
79401
  );
79354
79402
  break;
@@ -85964,7 +86012,6 @@ function createTypeChecker(host) {
85964
86012
  case 299 /* PropertyAssignment */:
85965
86013
  case 300 /* ShorthandPropertyAssignment */:
85966
86014
  case 267 /* NamespaceExportDeclaration */:
85967
- case 181 /* FunctionType */:
85968
86015
  case 279 /* MissingDeclaration */:
85969
86016
  return find(node.modifiers, isModifier);
85970
86017
  default:
@@ -92382,7 +92429,16 @@ function transformClassFields(context) {
92382
92429
  visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
92383
92430
  );
92384
92431
  }
92385
- return visitEachChild(node, visitor, context);
92432
+ return factory2.updatePropertyDeclaration(
92433
+ node,
92434
+ visitNodes2(node.modifiers, modifierVisitor, isModifier),
92435
+ visitNode(node.name, propertyNameVisitor, isPropertyName),
92436
+ /*questionOrExclamationToken*/
92437
+ void 0,
92438
+ /*type*/
92439
+ void 0,
92440
+ visitNode(node.initializer, visitor, isExpression)
92441
+ );
92386
92442
  }
92387
92443
  function transformPublicFieldInitializer(node) {
92388
92444
  if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
@@ -135429,7 +135485,8 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
135429
135485
  options.triggerCharacter,
135430
135486
  options.triggerKind,
135431
135487
  cancellationToken,
135432
- formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host)
135488
+ formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host),
135489
+ options.includeSymbol
135433
135490
  );
135434
135491
  }
135435
135492
  function getCompletionEntryDetails2(fileName, position, name, formattingOptions, source, preferences = emptyOptions, data) {
@@ -146958,13 +147015,7 @@ function createMethodImplementingSignatures(checker, context, enclosingDeclarati
146958
147015
  function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) {
146959
147016
  if (length(signatures)) {
146960
147017
  const type = checker.getUnionType(map(signatures, checker.getReturnTypeOfSignature));
146961
- return checker.typeToTypeNode(
146962
- type,
146963
- enclosingDeclaration,
146964
- /*flags*/
146965
- void 0,
146966
- getNoopSymbolTrackerWithResolver(context)
146967
- );
147018
+ return checker.typeToTypeNode(type, enclosingDeclaration, 1 /* NoTruncation */, getNoopSymbolTrackerWithResolver(context));
146968
147019
  }
146969
147020
  }
146970
147021
  function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference, body) {
@@ -147243,7 +147294,14 @@ function updatePropertyDeclaration(changeTracker, file, declaration, type, field
147243
147294
  changeTracker.replaceNode(file, declaration, property);
147244
147295
  }
147245
147296
  function updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName) {
147246
- const assignment = factory.updatePropertyAssignment(declaration, fieldName, declaration.initializer);
147297
+ let assignment = factory.updatePropertyAssignment(declaration, fieldName, declaration.initializer);
147298
+ if (assignment.modifiers || assignment.questionToken || assignment.exclamationToken) {
147299
+ if (assignment === declaration)
147300
+ assignment = factory.cloneNode(assignment);
147301
+ assignment.modifiers = void 0;
147302
+ assignment.questionToken = void 0;
147303
+ assignment.exclamationToken = void 0;
147304
+ }
147247
147305
  changeTracker.replacePropertyAssignment(file, declaration, assignment);
147248
147306
  }
147249
147307
  function updateFieldDeclaration(changeTracker, file, declaration, type, fieldName, modifiers) {
@@ -148263,7 +148321,7 @@ function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position,
148263
148321
  return result2 || (needsFullResolution ? "failed" : "skipped");
148264
148322
  }
148265
148323
  }
148266
- function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext) {
148324
+ function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
148267
148325
  var _a2;
148268
148326
  const { previousToken } = getRelevantTokens(position, sourceFile);
148269
148327
  if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
@@ -148285,7 +148343,7 @@ function getCompletionsAtPosition(host, program, log, sourceFile, position, pref
148285
148343
  } else {
148286
148344
  incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
148287
148345
  }
148288
- const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences);
148346
+ const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences, includeSymbol);
148289
148347
  if (stringCompletions) {
148290
148348
  return stringCompletions;
148291
148349
  }
@@ -148310,7 +148368,7 @@ function getCompletionsAtPosition(host, program, log, sourceFile, position, pref
148310
148368
  }
148311
148369
  switch (completionData.kind) {
148312
148370
  case 0 /* Data */:
148313
- const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position);
148371
+ const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol);
148314
148372
  if (response == null ? void 0 : response.isIncomplete) {
148315
148373
  incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
148316
148374
  }
@@ -148440,7 +148498,7 @@ function keywordFiltersFromSyntaxKind(keywordCompletion) {
148440
148498
  function getOptionalReplacementSpan(location) {
148441
148499
  return (location == null ? void 0 : location.kind) === 79 /* Identifier */ ? createTextSpanFromNode(location) : void 0;
148442
148500
  }
148443
- function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
148501
+ function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) {
148444
148502
  const {
148445
148503
  symbols,
148446
148504
  contextToken,
@@ -148514,7 +148572,8 @@ function completionInfoFromData(sourceFile, host, program, compilerOptions, log,
148514
148572
  symbolToOriginInfoMap,
148515
148573
  symbolToSortTextMap,
148516
148574
  isJsxIdentifierExpected,
148517
- isRightOfOpenTag
148575
+ isRightOfOpenTag,
148576
+ includeSymbol
148518
148577
  );
148519
148578
  if (keywordFilters !== 0 /* None */) {
148520
148579
  for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
@@ -148763,7 +148822,7 @@ function completionNameForLiteral(sourceFile, preferences, literal) {
148763
148822
  function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
148764
148823
  return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
148765
148824
  }
148766
- function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) {
148825
+ function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
148767
148826
  let insertText;
148768
148827
  let replacementSpan = getReplacementSpanForContextToken(replacementToken);
148769
148828
  let data;
@@ -148807,7 +148866,9 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
148807
148866
  }
148808
148867
  awaitText += `(await ${propertyAccessToConvert.expression.getText()})`;
148809
148868
  insertText = needsConvertPropertyAccess ? `${awaitText}${insertText}` : `${awaitText}${insertQuestionDot ? "?." : "."}${insertText}`;
148810
- replacementSpan = createTextSpanFromBounds(propertyAccessToConvert.getStart(sourceFile), propertyAccessToConvert.end);
148869
+ const isInAwaitExpression = tryCast(propertyAccessToConvert.parent, isAwaitExpression);
148870
+ const wrapNode = isInAwaitExpression ? propertyAccessToConvert.parent : propertyAccessToConvert.expression;
148871
+ replacementSpan = createTextSpanFromBounds(wrapNode.getStart(sourceFile), propertyAccessToConvert.end);
148811
148872
  }
148812
148873
  if (originIsResolvedExport(origin)) {
148813
148874
  sourceDisplay = [textPart(origin.moduleSpecifier)];
@@ -148875,7 +148936,8 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
148875
148936
  isSnippet,
148876
148937
  isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
148877
148938
  isImportStatementCompletion: !!importStatementCompletion || void 0,
148878
- data
148939
+ data,
148940
+ ...includeSymbol ? { symbol } : void 0
148879
148941
  };
148880
148942
  }
148881
148943
  function isClassLikeMemberCompletion(symbol, location, sourceFile) {
@@ -149345,7 +149407,7 @@ function getSourceFromOrigin(origin) {
149345
149407
  return "TypeOnlyAlias/" /* TypeOnlyAlias */;
149346
149408
  }
149347
149409
  }
149348
- function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) {
149410
+ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
149349
149411
  var _a2;
149350
149412
  const start2 = timestamp();
149351
149413
  const variableDeclaration = getVariableDeclaration(location);
@@ -149385,7 +149447,8 @@ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, con
149385
149447
  kind,
149386
149448
  formatContext,
149387
149449
  isJsxIdentifierExpected,
149388
- isRightOfOpenTag
149450
+ isRightOfOpenTag,
149451
+ includeSymbol
149389
149452
  );
149390
149453
  if (!entry) {
149391
149454
  continue;
@@ -151584,7 +151647,7 @@ function createNameAndKindSet() {
151584
151647
  values: map2.values.bind(map2)
151585
151648
  };
151586
151649
  }
151587
- function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
151650
+ function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
151588
151651
  if (isInReferenceComment(sourceFile, position)) {
151589
151652
  const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
151590
151653
  return entries && convertPathCompletions(entries);
@@ -151593,10 +151656,10 @@ function getStringLiteralCompletions(sourceFile, position, contextToken, options
151593
151656
  if (!contextToken || !isStringLiteralLike(contextToken))
151594
151657
  return void 0;
151595
151658
  const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
151596
- return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position);
151659
+ return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
151597
151660
  }
151598
151661
  }
151599
- function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position) {
151662
+ function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol) {
151600
151663
  if (completion === void 0) {
151601
151664
  return void 0;
151602
151665
  }
@@ -151622,7 +151685,28 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
151622
151685
  preferences,
151623
151686
  options,
151624
151687
  /*formatContext*/
151625
- void 0
151688
+ void 0,
151689
+ /*isTypeOnlyLocation */
151690
+ void 0,
151691
+ /*propertyAccessToConvert*/
151692
+ void 0,
151693
+ /*jsxIdentifierExpected*/
151694
+ void 0,
151695
+ /*isJsxInitializer*/
151696
+ void 0,
151697
+ /*importStatementCompletion*/
151698
+ void 0,
151699
+ /*recommendedCompletion*/
151700
+ void 0,
151701
+ /*symbolToOriginInfoMap*/
151702
+ void 0,
151703
+ /*symbolToSortTextMap*/
151704
+ void 0,
151705
+ /*isJsxIdentifierExpected*/
151706
+ void 0,
151707
+ /*isRightOfOpenTag*/
151708
+ void 0,
151709
+ includeSymbol
151626
151710
  );
151627
151711
  return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
151628
151712
  }
@@ -166373,7 +166457,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
166373
166457
  }
166374
166458
  function processChildNode(child, inheritedIndentation, parent2, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
166375
166459
  Debug.assert(!nodeIsSynthesized(child));
166376
- if (nodeIsMissing(child)) {
166460
+ if (nodeIsMissing(child) || isGrammarError(parent2, child)) {
166377
166461
  return inheritedIndentation;
166378
166462
  }
166379
166463
  const childStartPos = child.getStart(sourceFile);
@@ -168786,6 +168870,7 @@ __export(ts_exports3, {
168786
168870
  isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
168787
168871
  isGlobalDeclaration: () => isGlobalDeclaration,
168788
168872
  isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
168873
+ isGrammarError: () => isGrammarError,
168789
168874
  isHeritageClause: () => isHeritageClause,
168790
168875
  isHoistedFunction: () => isHoistedFunction,
168791
168876
  isHoistedVariableStatement: () => isHoistedVariableStatement,
@@ -182735,6 +182820,7 @@ start(initializeNodeSystem(), require("os").platform());
182735
182820
  isGetOrSetAccessorDeclaration,
182736
182821
  isGlobalDeclaration,
182737
182822
  isGlobalScopeAugmentation,
182823
+ isGrammarError,
182738
182824
  isHeritageClause,
182739
182825
  isHoistedFunction,
182740
182826
  isHoistedVariableStatement,
@@ -10073,6 +10073,13 @@ declare namespace ts {
10073
10073
  */
10074
10074
  triggerCharacter?: CompletionsTriggerCharacter;
10075
10075
  triggerKind?: CompletionTriggerKind;
10076
+ /**
10077
+ * Include a `symbol` property on each completion entry object.
10078
+ * Symbols reference cyclic data structures and sometimes an entire TypeChecker instance,
10079
+ * so use caution when serializing or retaining completion entries retrieved with this option.
10080
+ * @default false
10081
+ */
10082
+ includeSymbol?: boolean;
10076
10083
  /** @deprecated Use includeCompletionsForModuleExports */
10077
10084
  includeExternalModuleExports?: boolean;
10078
10085
  /** @deprecated Use includeCompletionsWithInsertText */
@@ -10630,6 +10637,12 @@ declare namespace ts {
10630
10637
  isFromUncheckedFile?: true;
10631
10638
  isPackageJsonImport?: true;
10632
10639
  isImportStatementCompletion?: true;
10640
+ /**
10641
+ * For API purposes.
10642
+ * Included for non-string completions only when `includeSymbol: true` option is passed to `getCompletionsAtPosition`.
10643
+ * @example Get declaration of completion: `symbol.valueDeclaration`
10644
+ */
10645
+ symbol?: Symbol;
10633
10646
  /**
10634
10647
  * A property to be sent back to TS Server in the CompletionDetailsRequest, along with `name`,
10635
10648
  * that allows TS Server to look up the symbol represented by the completion item, disambiguating