1namespace ts { 2 // branded string type used to store absolute, normalized and canonicalized paths 3 // arbitrary file name can be converted to Path via toPath function 4 export type Path = string & { __pathBrand: any }; 5 6 /* @internal */ 7 export type MatchingKeys<TRecord, TMatch, K extends keyof TRecord = keyof TRecord> = K extends (TRecord[K] extends TMatch ? K : never) ? K : never; 8 9 export interface TextRange { 10 pos: number; 11 end: number; 12 } 13 14 export interface ReadonlyTextRange { 15 readonly pos: number; 16 readonly end: number; 17 } 18 19 // token > SyntaxKind.Identifier => token is a keyword 20 // Also, If you add a new SyntaxKind be sure to keep the `Markers` section at the bottom in sync 21 export const enum SyntaxKind { 22 Unknown, 23 EndOfFileToken, 24 SingleLineCommentTrivia, 25 MultiLineCommentTrivia, 26 NewLineTrivia, 27 WhitespaceTrivia, 28 // We detect and preserve #! on the first line 29 ShebangTrivia, 30 // We detect and provide better error recovery when we encounter a git merge marker. This 31 // allows us to edit files with git-conflict markers in them in a much more pleasant manner. 32 ConflictMarkerTrivia, 33 // Literals 34 NumericLiteral, 35 BigIntLiteral, 36 StringLiteral, 37 JsxText, 38 JsxTextAllWhiteSpaces, 39 RegularExpressionLiteral, 40 NoSubstitutionTemplateLiteral, 41 // Pseudo-literals 42 TemplateHead, 43 TemplateMiddle, 44 TemplateTail, 45 // Punctuation 46 OpenBraceToken, 47 CloseBraceToken, 48 OpenParenToken, 49 CloseParenToken, 50 OpenBracketToken, 51 CloseBracketToken, 52 DotToken, 53 DotDotDotToken, 54 SemicolonToken, 55 CommaToken, 56 QuestionDotToken, 57 LessThanToken, 58 LessThanSlashToken, 59 GreaterThanToken, 60 LessThanEqualsToken, 61 GreaterThanEqualsToken, 62 EqualsEqualsToken, 63 ExclamationEqualsToken, 64 EqualsEqualsEqualsToken, 65 ExclamationEqualsEqualsToken, 66 EqualsGreaterThanToken, 67 PlusToken, 68 MinusToken, 69 AsteriskToken, 70 AsteriskAsteriskToken, 71 SlashToken, 72 PercentToken, 73 PlusPlusToken, 74 MinusMinusToken, 75 LessThanLessThanToken, 76 GreaterThanGreaterThanToken, 77 GreaterThanGreaterThanGreaterThanToken, 78 AmpersandToken, 79 BarToken, 80 CaretToken, 81 ExclamationToken, 82 TildeToken, 83 AmpersandAmpersandToken, 84 BarBarToken, 85 QuestionToken, 86 ColonToken, 87 AtToken, 88 QuestionQuestionToken, 89 /** Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. */ 90 BacktickToken, 91 /** Only the JSDoc scanner produces HashToken. The normal scanner produces PrivateIdentifier. */ 92 HashToken, 93 // Assignments 94 EqualsToken, 95 PlusEqualsToken, 96 MinusEqualsToken, 97 AsteriskEqualsToken, 98 AsteriskAsteriskEqualsToken, 99 SlashEqualsToken, 100 PercentEqualsToken, 101 LessThanLessThanEqualsToken, 102 GreaterThanGreaterThanEqualsToken, 103 GreaterThanGreaterThanGreaterThanEqualsToken, 104 AmpersandEqualsToken, 105 BarEqualsToken, 106 BarBarEqualsToken, 107 AmpersandAmpersandEqualsToken, 108 QuestionQuestionEqualsToken, 109 CaretEqualsToken, 110 // Identifiers and PrivateIdentifiers 111 Identifier, 112 PrivateIdentifier, 113 // Reserved words 114 BreakKeyword, 115 CaseKeyword, 116 CatchKeyword, 117 ClassKeyword, 118 StructKeyword, 119 ConstKeyword, 120 ContinueKeyword, 121 DebuggerKeyword, 122 DefaultKeyword, 123 DeleteKeyword, 124 DoKeyword, 125 ElseKeyword, 126 EnumKeyword, 127 ExportKeyword, 128 ExtendsKeyword, 129 FalseKeyword, 130 FinallyKeyword, 131 ForKeyword, 132 FunctionKeyword, 133 IfKeyword, 134 ImportKeyword, 135 InKeyword, 136 InstanceOfKeyword, 137 NewKeyword, 138 NullKeyword, 139 ReturnKeyword, 140 SuperKeyword, 141 SwitchKeyword, 142 ThisKeyword, 143 ThrowKeyword, 144 TrueKeyword, 145 TryKeyword, 146 TypeOfKeyword, 147 VarKeyword, 148 VoidKeyword, 149 WhileKeyword, 150 WithKeyword, 151 // Strict mode reserved words 152 ImplementsKeyword, 153 InterfaceKeyword, 154 LetKeyword, 155 PackageKeyword, 156 PrivateKeyword, 157 ProtectedKeyword, 158 PublicKeyword, 159 StaticKeyword, 160 YieldKeyword, 161 // Contextual keywords 162 AbstractKeyword, 163 AccessorKeyword, 164 AsKeyword, 165 AssertsKeyword, 166 AssertKeyword, 167 AnyKeyword, 168 AsyncKeyword, 169 AwaitKeyword, 170 BooleanKeyword, 171 ConstructorKeyword, 172 DeclareKeyword, 173 GetKeyword, 174 InferKeyword, 175 IntrinsicKeyword, 176 IsKeyword, 177 KeyOfKeyword, 178 ModuleKeyword, 179 NamespaceKeyword, 180 NeverKeyword, 181 OutKeyword, 182 ReadonlyKeyword, 183 RequireKeyword, 184 NumberKeyword, 185 ObjectKeyword, 186 SatisfiesKeyword, 187 SetKeyword, 188 StringKeyword, 189 SymbolKeyword, 190 TypeKeyword, 191 UndefinedKeyword, 192 UniqueKeyword, 193 UnknownKeyword, 194 FromKeyword, 195 GlobalKeyword, 196 BigIntKeyword, 197 OverrideKeyword, 198 OfKeyword, // LastKeyword and LastToken and LastContextualKeyword 199 200 // Parse tree nodes 201 202 // Names 203 QualifiedName, 204 ComputedPropertyName, 205 // Signature elements 206 TypeParameter, 207 Parameter, 208 Decorator, 209 // TypeMember 210 PropertySignature, 211 PropertyDeclaration, 212 MethodSignature, 213 MethodDeclaration, 214 ClassStaticBlockDeclaration, 215 Constructor, 216 GetAccessor, 217 SetAccessor, 218 CallSignature, 219 ConstructSignature, 220 IndexSignature, 221 // Type 222 TypePredicate, 223 TypeReference, 224 FunctionType, 225 ConstructorType, 226 TypeQuery, 227 TypeLiteral, 228 ArrayType, 229 TupleType, 230 OptionalType, 231 RestType, 232 UnionType, 233 IntersectionType, 234 ConditionalType, 235 InferType, 236 ParenthesizedType, 237 ThisType, 238 TypeOperator, 239 IndexedAccessType, 240 MappedType, 241 LiteralType, 242 NamedTupleMember, 243 TemplateLiteralType, 244 TemplateLiteralTypeSpan, 245 ImportType, 246 // Binding patterns 247 ObjectBindingPattern, 248 ArrayBindingPattern, 249 BindingElement, 250 // Expression 251 ArrayLiteralExpression, 252 ObjectLiteralExpression, 253 PropertyAccessExpression, 254 ElementAccessExpression, 255 CallExpression, 256 NewExpression, 257 TaggedTemplateExpression, 258 TypeAssertionExpression, 259 ParenthesizedExpression, 260 FunctionExpression, 261 ArrowFunction, 262 EtsComponentExpression, 263 DeleteExpression, 264 TypeOfExpression, 265 VoidExpression, 266 AwaitExpression, 267 PrefixUnaryExpression, 268 PostfixUnaryExpression, 269 BinaryExpression, 270 ConditionalExpression, 271 TemplateExpression, 272 YieldExpression, 273 SpreadElement, 274 ClassExpression, 275 OmittedExpression, 276 ExpressionWithTypeArguments, 277 AsExpression, 278 NonNullExpression, 279 MetaProperty, 280 SyntheticExpression, 281 SatisfiesExpression, 282 283 // Misc 284 TemplateSpan, 285 SemicolonClassElement, 286 // Element 287 Block, 288 EmptyStatement, 289 VariableStatement, 290 ExpressionStatement, 291 IfStatement, 292 DoStatement, 293 WhileStatement, 294 ForStatement, 295 ForInStatement, 296 ForOfStatement, 297 ContinueStatement, 298 BreakStatement, 299 ReturnStatement, 300 WithStatement, 301 SwitchStatement, 302 LabeledStatement, 303 ThrowStatement, 304 TryStatement, 305 DebuggerStatement, 306 VariableDeclaration, 307 VariableDeclarationList, 308 FunctionDeclaration, 309 ClassDeclaration, 310 StructDeclaration, 311 InterfaceDeclaration, 312 TypeAliasDeclaration, 313 EnumDeclaration, 314 ModuleDeclaration, 315 ModuleBlock, 316 CaseBlock, 317 NamespaceExportDeclaration, 318 ImportEqualsDeclaration, 319 ImportDeclaration, 320 ImportClause, 321 NamespaceImport, 322 NamedImports, 323 ImportSpecifier, 324 ExportAssignment, 325 ExportDeclaration, 326 NamedExports, 327 NamespaceExport, 328 ExportSpecifier, 329 MissingDeclaration, 330 331 // Module references 332 ExternalModuleReference, 333 334 // JSX 335 JsxElement, 336 JsxSelfClosingElement, 337 JsxOpeningElement, 338 JsxClosingElement, 339 JsxFragment, 340 JsxOpeningFragment, 341 JsxClosingFragment, 342 JsxAttribute, 343 JsxAttributes, 344 JsxSpreadAttribute, 345 JsxExpression, 346 347 // Clauses 348 CaseClause, 349 DefaultClause, 350 HeritageClause, 351 CatchClause, 352 AssertClause, 353 AssertEntry, 354 ImportTypeAssertionContainer, 355 356 // Property assignments 357 PropertyAssignment, 358 ShorthandPropertyAssignment, 359 SpreadAssignment, 360 361 // Enum 362 EnumMember, 363 // Unparsed 364 UnparsedPrologue, 365 UnparsedPrepend, 366 UnparsedText, 367 UnparsedInternalText, 368 UnparsedSyntheticReference, 369 370 // Top-level nodes 371 SourceFile, 372 Bundle, 373 UnparsedSource, 374 InputFiles, 375 376 // JSDoc nodes 377 JSDocTypeExpression, 378 JSDocNameReference, 379 JSDocMemberName, // C#p 380 JSDocAllType, // The * type 381 JSDocUnknownType, // The ? type 382 JSDocNullableType, 383 JSDocNonNullableType, 384 JSDocOptionalType, 385 JSDocFunctionType, 386 JSDocVariadicType, 387 JSDocNamepathType, // https://jsdoc.app/about-namepaths.html 388 JSDoc, 389 /** @deprecated Use SyntaxKind.JSDoc */ 390 JSDocComment = JSDoc, 391 JSDocText, 392 JSDocTypeLiteral, 393 JSDocSignature, 394 JSDocLink, 395 JSDocLinkCode, 396 JSDocLinkPlain, 397 JSDocTag, 398 JSDocAugmentsTag, 399 JSDocImplementsTag, 400 JSDocAuthorTag, 401 JSDocDeprecatedTag, 402 JSDocClassTag, 403 JSDocPublicTag, 404 JSDocPrivateTag, 405 JSDocProtectedTag, 406 JSDocReadonlyTag, 407 JSDocOverrideTag, 408 JSDocCallbackTag, 409 JSDocEnumTag, 410 JSDocParameterTag, 411 JSDocReturnTag, 412 JSDocThisTag, 413 JSDocTypeTag, 414 JSDocTemplateTag, 415 JSDocTypedefTag, 416 JSDocSeeTag, 417 JSDocPropertyTag, 418 419 // Synthesized list 420 SyntaxList, 421 422 // Transformation nodes 423 NotEmittedStatement, 424 PartiallyEmittedExpression, 425 CommaListExpression, 426 MergeDeclarationMarker, 427 EndOfDeclarationMarker, 428 SyntheticReferenceExpression, 429 430 // Enum value count 431 Count, 432 433 // Markers 434 FirstAssignment = EqualsToken, 435 LastAssignment = CaretEqualsToken, 436 FirstCompoundAssignment = PlusEqualsToken, 437 LastCompoundAssignment = CaretEqualsToken, 438 FirstReservedWord = BreakKeyword, 439 LastReservedWord = WithKeyword, 440 FirstKeyword = BreakKeyword, 441 LastKeyword = OfKeyword, 442 FirstFutureReservedWord = ImplementsKeyword, 443 LastFutureReservedWord = YieldKeyword, 444 FirstTypeNode = TypePredicate, 445 LastTypeNode = ImportType, 446 FirstPunctuation = OpenBraceToken, 447 LastPunctuation = CaretEqualsToken, 448 FirstToken = Unknown, 449 LastToken = LastKeyword, 450 FirstTriviaToken = SingleLineCommentTrivia, 451 LastTriviaToken = ConflictMarkerTrivia, 452 FirstLiteralToken = NumericLiteral, 453 LastLiteralToken = NoSubstitutionTemplateLiteral, 454 FirstTemplateToken = NoSubstitutionTemplateLiteral, 455 LastTemplateToken = TemplateTail, 456 FirstBinaryOperator = LessThanToken, 457 LastBinaryOperator = CaretEqualsToken, 458 FirstStatement = VariableStatement, 459 LastStatement = DebuggerStatement, 460 FirstNode = QualifiedName, 461 FirstJSDocNode = JSDocTypeExpression, 462 LastJSDocNode = JSDocPropertyTag, 463 FirstJSDocTagNode = JSDocTag, 464 LastJSDocTagNode = JSDocPropertyTag, 465 /* @internal */ FirstContextualKeyword = AbstractKeyword, 466 /* @internal */ LastContextualKeyword = OfKeyword, 467 } 468 469 export type TriviaSyntaxKind = 470 | SyntaxKind.SingleLineCommentTrivia 471 | SyntaxKind.MultiLineCommentTrivia 472 | SyntaxKind.NewLineTrivia 473 | SyntaxKind.WhitespaceTrivia 474 | SyntaxKind.ShebangTrivia 475 | SyntaxKind.ConflictMarkerTrivia 476 ; 477 478 export type LiteralSyntaxKind = 479 | SyntaxKind.NumericLiteral 480 | SyntaxKind.BigIntLiteral 481 | SyntaxKind.StringLiteral 482 | SyntaxKind.JsxText 483 | SyntaxKind.JsxTextAllWhiteSpaces 484 | SyntaxKind.RegularExpressionLiteral 485 | SyntaxKind.NoSubstitutionTemplateLiteral 486 ; 487 488 export type PseudoLiteralSyntaxKind = 489 | SyntaxKind.TemplateHead 490 | SyntaxKind.TemplateMiddle 491 | SyntaxKind.TemplateTail 492 ; 493 494 export type PunctuationSyntaxKind = 495 | SyntaxKind.OpenBraceToken 496 | SyntaxKind.CloseBraceToken 497 | SyntaxKind.OpenParenToken 498 | SyntaxKind.CloseParenToken 499 | SyntaxKind.OpenBracketToken 500 | SyntaxKind.CloseBracketToken 501 | SyntaxKind.DotToken 502 | SyntaxKind.DotDotDotToken 503 | SyntaxKind.SemicolonToken 504 | SyntaxKind.CommaToken 505 | SyntaxKind.QuestionDotToken 506 | SyntaxKind.LessThanToken 507 | SyntaxKind.LessThanSlashToken 508 | SyntaxKind.GreaterThanToken 509 | SyntaxKind.LessThanEqualsToken 510 | SyntaxKind.GreaterThanEqualsToken 511 | SyntaxKind.EqualsEqualsToken 512 | SyntaxKind.ExclamationEqualsToken 513 | SyntaxKind.EqualsEqualsEqualsToken 514 | SyntaxKind.ExclamationEqualsEqualsToken 515 | SyntaxKind.EqualsGreaterThanToken 516 | SyntaxKind.PlusToken 517 | SyntaxKind.MinusToken 518 | SyntaxKind.AsteriskToken 519 | SyntaxKind.AsteriskAsteriskToken 520 | SyntaxKind.SlashToken 521 | SyntaxKind.PercentToken 522 | SyntaxKind.PlusPlusToken 523 | SyntaxKind.MinusMinusToken 524 | SyntaxKind.LessThanLessThanToken 525 | SyntaxKind.GreaterThanGreaterThanToken 526 | SyntaxKind.GreaterThanGreaterThanGreaterThanToken 527 | SyntaxKind.AmpersandToken 528 | SyntaxKind.BarToken 529 | SyntaxKind.CaretToken 530 | SyntaxKind.ExclamationToken 531 | SyntaxKind.TildeToken 532 | SyntaxKind.AmpersandAmpersandToken 533 | SyntaxKind.BarBarToken 534 | SyntaxKind.QuestionQuestionToken 535 | SyntaxKind.QuestionToken 536 | SyntaxKind.ColonToken 537 | SyntaxKind.AtToken 538 | SyntaxKind.BacktickToken 539 | SyntaxKind.HashToken 540 | SyntaxKind.EqualsToken 541 | SyntaxKind.PlusEqualsToken 542 | SyntaxKind.MinusEqualsToken 543 | SyntaxKind.AsteriskEqualsToken 544 | SyntaxKind.AsteriskAsteriskEqualsToken 545 | SyntaxKind.SlashEqualsToken 546 | SyntaxKind.PercentEqualsToken 547 | SyntaxKind.LessThanLessThanEqualsToken 548 | SyntaxKind.GreaterThanGreaterThanEqualsToken 549 | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken 550 | SyntaxKind.AmpersandEqualsToken 551 | SyntaxKind.BarEqualsToken 552 | SyntaxKind.CaretEqualsToken 553 ; 554 555 export type KeywordSyntaxKind = 556 | SyntaxKind.AbstractKeyword 557 | SyntaxKind.AccessorKeyword 558 | SyntaxKind.AnyKeyword 559 | SyntaxKind.AsKeyword 560 | SyntaxKind.AssertsKeyword 561 | SyntaxKind.AssertKeyword 562 | SyntaxKind.AsyncKeyword 563 | SyntaxKind.AwaitKeyword 564 | SyntaxKind.BigIntKeyword 565 | SyntaxKind.BooleanKeyword 566 | SyntaxKind.BreakKeyword 567 | SyntaxKind.CaseKeyword 568 | SyntaxKind.CatchKeyword 569 | SyntaxKind.ClassKeyword 570 | SyntaxKind.StructKeyword 571 | SyntaxKind.ConstKeyword 572 | SyntaxKind.ConstructorKeyword 573 | SyntaxKind.ContinueKeyword 574 | SyntaxKind.DebuggerKeyword 575 | SyntaxKind.DeclareKeyword 576 | SyntaxKind.DefaultKeyword 577 | SyntaxKind.DeleteKeyword 578 | SyntaxKind.DoKeyword 579 | SyntaxKind.ElseKeyword 580 | SyntaxKind.EnumKeyword 581 | SyntaxKind.ExportKeyword 582 | SyntaxKind.ExtendsKeyword 583 | SyntaxKind.FalseKeyword 584 | SyntaxKind.FinallyKeyword 585 | SyntaxKind.ForKeyword 586 | SyntaxKind.FromKeyword 587 | SyntaxKind.FunctionKeyword 588 | SyntaxKind.GetKeyword 589 | SyntaxKind.GlobalKeyword 590 | SyntaxKind.IfKeyword 591 | SyntaxKind.ImplementsKeyword 592 | SyntaxKind.ImportKeyword 593 | SyntaxKind.InferKeyword 594 | SyntaxKind.InKeyword 595 | SyntaxKind.InstanceOfKeyword 596 | SyntaxKind.InterfaceKeyword 597 | SyntaxKind.IntrinsicKeyword 598 | SyntaxKind.IsKeyword 599 | SyntaxKind.KeyOfKeyword 600 | SyntaxKind.LetKeyword 601 | SyntaxKind.ModuleKeyword 602 | SyntaxKind.NamespaceKeyword 603 | SyntaxKind.NeverKeyword 604 | SyntaxKind.NewKeyword 605 | SyntaxKind.NullKeyword 606 | SyntaxKind.NumberKeyword 607 | SyntaxKind.ObjectKeyword 608 | SyntaxKind.OfKeyword 609 | SyntaxKind.PackageKeyword 610 | SyntaxKind.PrivateKeyword 611 | SyntaxKind.ProtectedKeyword 612 | SyntaxKind.PublicKeyword 613 | SyntaxKind.ReadonlyKeyword 614 | SyntaxKind.OutKeyword 615 | SyntaxKind.OverrideKeyword 616 | SyntaxKind.RequireKeyword 617 | SyntaxKind.ReturnKeyword 618 | SyntaxKind.SatisfiesKeyword 619 | SyntaxKind.SetKeyword 620 | SyntaxKind.StaticKeyword 621 | SyntaxKind.StringKeyword 622 | SyntaxKind.SuperKeyword 623 | SyntaxKind.SwitchKeyword 624 | SyntaxKind.SymbolKeyword 625 | SyntaxKind.ThisKeyword 626 | SyntaxKind.ThrowKeyword 627 | SyntaxKind.TrueKeyword 628 | SyntaxKind.TryKeyword 629 | SyntaxKind.TypeKeyword 630 | SyntaxKind.TypeOfKeyword 631 | SyntaxKind.UndefinedKeyword 632 | SyntaxKind.UniqueKeyword 633 | SyntaxKind.UnknownKeyword 634 | SyntaxKind.VarKeyword 635 | SyntaxKind.VoidKeyword 636 | SyntaxKind.WhileKeyword 637 | SyntaxKind.WithKeyword 638 | SyntaxKind.YieldKeyword 639 ; 640 641 export type ModifierSyntaxKind = 642 | SyntaxKind.AbstractKeyword 643 | SyntaxKind.AccessorKeyword 644 | SyntaxKind.AsyncKeyword 645 | SyntaxKind.ConstKeyword 646 | SyntaxKind.DeclareKeyword 647 | SyntaxKind.DefaultKeyword 648 | SyntaxKind.ExportKeyword 649 | SyntaxKind.InKeyword 650 | SyntaxKind.PrivateKeyword 651 | SyntaxKind.ProtectedKeyword 652 | SyntaxKind.PublicKeyword 653 | SyntaxKind.ReadonlyKeyword 654 | SyntaxKind.OutKeyword 655 | SyntaxKind.OverrideKeyword 656 | SyntaxKind.StaticKeyword 657 ; 658 659 export type KeywordTypeSyntaxKind = 660 | SyntaxKind.AnyKeyword 661 | SyntaxKind.BigIntKeyword 662 | SyntaxKind.BooleanKeyword 663 | SyntaxKind.IntrinsicKeyword 664 | SyntaxKind.NeverKeyword 665 | SyntaxKind.NumberKeyword 666 | SyntaxKind.ObjectKeyword 667 | SyntaxKind.StringKeyword 668 | SyntaxKind.SymbolKeyword 669 | SyntaxKind.UndefinedKeyword 670 | SyntaxKind.UnknownKeyword 671 | SyntaxKind.VoidKeyword 672 ; 673 674 /* @internal */ 675 export type TypeNodeSyntaxKind = 676 | KeywordTypeSyntaxKind 677 | SyntaxKind.TypePredicate 678 | SyntaxKind.TypeReference 679 | SyntaxKind.FunctionType 680 | SyntaxKind.ConstructorType 681 | SyntaxKind.TypeQuery 682 | SyntaxKind.TypeLiteral 683 | SyntaxKind.ArrayType 684 | SyntaxKind.TupleType 685 | SyntaxKind.NamedTupleMember 686 | SyntaxKind.OptionalType 687 | SyntaxKind.RestType 688 | SyntaxKind.UnionType 689 | SyntaxKind.IntersectionType 690 | SyntaxKind.ConditionalType 691 | SyntaxKind.InferType 692 | SyntaxKind.ParenthesizedType 693 | SyntaxKind.ThisType 694 | SyntaxKind.TypeOperator 695 | SyntaxKind.IndexedAccessType 696 | SyntaxKind.MappedType 697 | SyntaxKind.LiteralType 698 | SyntaxKind.TemplateLiteralType 699 | SyntaxKind.TemplateLiteralTypeSpan 700 | SyntaxKind.ImportType 701 | SyntaxKind.ExpressionWithTypeArguments 702 | SyntaxKind.JSDocTypeExpression 703 | SyntaxKind.JSDocAllType 704 | SyntaxKind.JSDocUnknownType 705 | SyntaxKind.JSDocNonNullableType 706 | SyntaxKind.JSDocNullableType 707 | SyntaxKind.JSDocOptionalType 708 | SyntaxKind.JSDocFunctionType 709 | SyntaxKind.JSDocVariadicType 710 | SyntaxKind.JSDocNamepathType 711 | SyntaxKind.JSDocSignature 712 | SyntaxKind.JSDocTypeLiteral 713 ; 714 715 export type TokenSyntaxKind = 716 | SyntaxKind.Unknown 717 | SyntaxKind.EndOfFileToken 718 | TriviaSyntaxKind 719 | LiteralSyntaxKind 720 | PseudoLiteralSyntaxKind 721 | PunctuationSyntaxKind 722 | SyntaxKind.Identifier 723 | KeywordSyntaxKind 724 ; 725 726 export type JsxTokenSyntaxKind = 727 | SyntaxKind.LessThanSlashToken 728 | SyntaxKind.EndOfFileToken 729 | SyntaxKind.ConflictMarkerTrivia 730 | SyntaxKind.JsxText 731 | SyntaxKind.JsxTextAllWhiteSpaces 732 | SyntaxKind.OpenBraceToken 733 | SyntaxKind.LessThanToken 734 ; 735 736 export type JSDocSyntaxKind = 737 | SyntaxKind.EndOfFileToken 738 | SyntaxKind.WhitespaceTrivia 739 | SyntaxKind.AtToken 740 | SyntaxKind.NewLineTrivia 741 | SyntaxKind.AsteriskToken 742 | SyntaxKind.OpenBraceToken 743 | SyntaxKind.CloseBraceToken 744 | SyntaxKind.LessThanToken 745 | SyntaxKind.GreaterThanToken 746 | SyntaxKind.OpenBracketToken 747 | SyntaxKind.CloseBracketToken 748 | SyntaxKind.EqualsToken 749 | SyntaxKind.CommaToken 750 | SyntaxKind.DotToken 751 | SyntaxKind.Identifier 752 | SyntaxKind.BacktickToken 753 | SyntaxKind.HashToken 754 | SyntaxKind.Unknown 755 | KeywordSyntaxKind 756 ; 757 758 export const enum NodeFlags { 759 None = 0, 760 Let = 1 << 0, // Variable declaration 761 Const = 1 << 1, // Variable declaration 762 NestedNamespace = 1 << 2, // Namespace declaration 763 Synthesized = 1 << 3, // Node was synthesized during transformation 764 Namespace = 1 << 4, // Namespace declaration 765 OptionalChain = 1 << 5, // Chained MemberExpression rooted to a pseudo-OptionalExpression 766 ExportContext = 1 << 6, // Export context (initialized by binding) 767 ContainsThis = 1 << 7, // Interface contains references to "this" 768 HasImplicitReturn = 1 << 8, // If function implicitly returns on one of codepaths (initialized by binding) 769 HasExplicitReturn = 1 << 9, // If function has explicit reachable return on one of codepaths (initialized by binding) 770 GlobalAugmentation = 1 << 10, // Set if module declaration is an augmentation for the global scope 771 HasAsyncFunctions = 1 << 11, // If the file has async functions (initialized by binding) 772 DisallowInContext = 1 << 12, // If node was parsed in a context where 'in-expressions' are not allowed 773 YieldContext = 1 << 13, // If node was parsed in the 'yield' context created when parsing a generator 774 DecoratorContext = 1 << 14, // If node was parsed as part of a decorator 775 AwaitContext = 1 << 15, // If node was parsed in the 'await' context created when parsing an async function 776 DisallowConditionalTypesContext = 1 << 16, // If node was parsed in a context where conditional types are not allowed 777 ThisNodeHasError = 1 << 17, // If the parser encountered an error when parsing the code that created this node 778 JavaScriptFile = 1 << 18, // If node was parsed in a JavaScript 779 ThisNodeOrAnySubNodesHasError = 1 << 19, // If this node or any of its children had an error 780 HasAggregatedChildData = 1 << 20, // If we've computed data from children and cached it in this node 781 782 // These flags will be set when the parser encounters a dynamic import expression or 'import.meta' to avoid 783 // walking the tree if the flags are not set. However, these flags are just a approximation 784 // (hence why it's named "PossiblyContainsDynamicImport") because once set, the flags never get cleared. 785 // During editing, if a dynamic import is removed, incremental parsing will *NOT* clear this flag. 786 // This means that the tree will always be traversed during module resolution, or when looking for external module indicators. 787 // However, the removal operation should not occur often and in the case of the 788 // removal, it is likely that users will add the import anyway. 789 // The advantage of this approach is its simplicity. For the case of batch compilation, 790 // we guarantee that users won't have to pay the price of walking the tree if a dynamic import isn't used. 791 /* @internal */ PossiblyContainsDynamicImport = 1 << 21, 792 /* @internal */ PossiblyContainsImportMeta = 1 << 22, 793 794 JSDoc = 1 << 23, // If node was parsed inside jsdoc 795 /* @internal */ Ambient = 1 << 24, // If node was inside an ambient context -- a declaration file, or inside something with the `declare` modifier. 796 /* @internal */ InWithStatement = 1 << 25, // If any ancestor of node was the `statement` of a WithStatement (not the `expression`) 797 JsonFile = 1 << 26, // If node was parsed in a Json 798 /* @internal */ TypeCached = 1 << 27, // If a type was cached for node at any point 799 /* @internal */ Deprecated = 1 << 28, // If has '@deprecated' JSDoc tag 800 801 EtsContext = 1 << 30, // If context was parsed as a Struct 802 803 BlockScoped = Let | Const, 804 805 ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn, 806 ReachabilityAndEmitFlags = ReachabilityCheckFlags | HasAsyncFunctions, 807 808 // Parsing context flags 809 ContextFlags = DisallowInContext | DisallowConditionalTypesContext | YieldContext | DecoratorContext | AwaitContext | JavaScriptFile | InWithStatement | Ambient | EtsContext, 810 811 // Exclude these flags when parsing a Type 812 TypeExcludesFlags = YieldContext | AwaitContext, 813 814 // Represents all flags that are potentially set once and 815 // never cleared on SourceFiles which get re-used in between incremental parses. 816 // See the comment above on `PossiblyContainsDynamicImport` and `PossiblyContainsImportMeta`. 817 /* @internal */ PermanentlySetIncrementalFlags = PossiblyContainsDynamicImport | PossiblyContainsImportMeta, 818 } 819 820 export const enum EtsFlags { 821 None = 0, 822 StructContext = 1 << 1, // If context was parsed as a Struct 823 EtsExtendComponentsContext = 1 << 2, // If context was parsed as Ets Extend Components 824 EtsStylesComponentsContext = 1 << 3, // If context was parsed as Ets Styles Components 825 EtsBuildContext = 1 << 4, // If context was parsed as Ets build methods 826 EtsBuilderContext = 1 << 5, // If context was parsed as Ets builder methods or functions 827 EtsStateStylesContext = 1 << 6, // If context was parsed as Ets stateStyles Components 828 EtsComponentsContext = 1 << 7, // If context was parsed as a Ets Components 829 EtsNewExpressionContext = 1 << 8, // If context was parsed ad a new expression 830 } 831 832 export const enum ModifierFlags { 833 None = 0, 834 Export = 1 << 0, // Declarations 835 Ambient = 1 << 1, // Declarations 836 Public = 1 << 2, // Property/Method 837 Private = 1 << 3, // Property/Method 838 Protected = 1 << 4, // Property/Method 839 Static = 1 << 5, // Property/Method 840 Readonly = 1 << 6, // Property/Method 841 Accessor = 1 << 7, // Property 842 Abstract = 1 << 8, // Class/Method/ConstructSignature 843 Async = 1 << 9, // Property/Method/Function 844 Default = 1 << 10, // Function/Class (export default declaration) 845 Const = 1 << 11, // Const enum 846 HasComputedJSDocModifiers = 1 << 12, // Indicates the computed modifier flags include modifiers from JSDoc. 847 848 Deprecated = 1 << 13, // Deprecated tag. 849 Override = 1 << 14, // Override method. 850 In = 1 << 15, // Contravariance modifier 851 Out = 1 << 16, // Covariance modifier 852 Decorator = 1 << 17, // Contains a decorator. 853 HasComputedFlags = 1 << 29, // Modifier flags have been computed 854 855 AccessibilityModifier = Public | Private | Protected, 856 // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. 857 ParameterPropertyModifier = AccessibilityModifier | Readonly | Override, 858 NonPublicAccessibilityModifier = Private | Protected, 859 860 TypeScriptModifier = Ambient | Public | Private | Protected | Readonly | Abstract | Const | Override | In | Out, 861 ExportDefault = Export | Default, 862 All = Export | Ambient | Public | Private | Protected | Static | Readonly | Abstract | Accessor | Async | Default | Const | Deprecated | Override | In | Out | Decorator, 863 Modifier = All & ~Decorator 864 } 865 866 export const enum JsxFlags { 867 None = 0, 868 /** An element from a named property of the JSX.IntrinsicElements interface */ 869 IntrinsicNamedElement = 1 << 0, 870 /** An element inferred from the string index signature of the JSX.IntrinsicElements interface */ 871 IntrinsicIndexedElement = 1 << 1, 872 873 IntrinsicElement = IntrinsicNamedElement | IntrinsicIndexedElement, 874 } 875 876 /* @internal */ 877 export const enum RelationComparisonResult { 878 Succeeded = 1 << 0, // Should be truthy 879 Failed = 1 << 1, 880 Reported = 1 << 2, 881 882 ReportsUnmeasurable = 1 << 3, 883 ReportsUnreliable = 1 << 4, 884 ReportsMask = ReportsUnmeasurable | ReportsUnreliable 885 } 886 887 /* @internal */ 888 export type NodeId = number; 889 890 export interface Node extends ReadonlyTextRange { 891 readonly kind: SyntaxKind; 892 readonly flags: NodeFlags; 893 /* @internal */ modifierFlagsCache: ModifierFlags; 894 /* @internal */ readonly transformFlags: TransformFlags; // Flags for transforms 895 /* @internal */ id?: NodeId; // Unique id (used to look up NodeLinks) 896 readonly parent: Node; // Parent node (initialized by binding) 897 /* @internal */ original?: Node; // The original node if this is an updated node. 898 symbol: Symbol; // Symbol declared by node (initialized by binding) 899 locals?: SymbolTable; // Locals associated with node (initialized by binding) 900 /* @internal */ nextContainer?: Node; // Next container in declaration order (initialized by binding) 901 /* @internal */ localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes) 902 /* @internal */ flowNode?: FlowNode; // Associated FlowNode (initialized by binding) 903 /* @internal */ emitNode?: EmitNode; // Associated EmitNode (initialized by transforms) 904 /* @internal */ contextualType?: Type; // Used to temporarily assign a contextual type during overload resolution 905 /* @internal */ inferenceContext?: InferenceContext; // Inference context for contextual type 906 /* @internal */ virtual?: boolean; // Present node is virtual node 907 skipCheck?: boolean; 908 } 909 910 export interface JSDocContainer { 911 /* @internal */ jsDoc?: JSDoc[]; // JSDoc that directly precedes this node 912 /* @internal */ jsDocCache?: readonly JSDocTag[]; // Cache for getJSDocTags 913 } 914 915 // Ideally, `ForEachChildNodes` and `VisitEachChildNodes` would not differ. 916 // However, `forEachChild` currently processes JSDoc comment syntax and missing declarations more thoroughly. 917 // On the other hand, `visitEachChild` actually processes `Identifier`s (which really *shouldn't* have children, 918 // but are constructed as if they could for faked-up `QualifiedName`s in the language service.) 919 920 /* @internal */ 921 export type ForEachChildNodes = 922 | HasChildren 923 | MissingDeclaration 924 | JSDocTypeExpression 925 | JSDocNonNullableType 926 | JSDocNullableType 927 | JSDocOptionalType 928 | JSDocVariadicType 929 | JSDocFunctionType 930 | JSDoc 931 | JSDocSeeTag 932 | JSDocNameReference 933 | JSDocMemberName 934 | JSDocParameterTag 935 | JSDocPropertyTag 936 | JSDocAuthorTag 937 | JSDocImplementsTag 938 | JSDocAugmentsTag 939 | JSDocTemplateTag 940 | JSDocTypedefTag 941 | JSDocCallbackTag 942 | JSDocReturnTag 943 | JSDocTypeTag 944 | JSDocThisTag 945 | JSDocEnumTag 946 | JSDocSignature 947 | JSDocLink 948 | JSDocLinkCode 949 | JSDocLinkPlain 950 | JSDocTypeLiteral 951 | JSDocUnknownTag 952 | JSDocClassTag 953 | JSDocPublicTag 954 | JSDocPrivateTag 955 | JSDocProtectedTag 956 | JSDocReadonlyTag 957 | JSDocDeprecatedTag 958 | JSDocOverrideTag 959 ; 960 961 /* @internal */ 962 export type VisitEachChildNodes = 963 | HasChildren 964 | Identifier 965 ; 966 967 /* @internal */ 968 export type HasChildren = 969 | QualifiedName 970 | ComputedPropertyName 971 | TypeParameterDeclaration 972 | ParameterDeclaration 973 | Decorator 974 | PropertySignature 975 | PropertyDeclaration 976 | MethodSignature 977 | MethodDeclaration 978 | ConstructorDeclaration 979 | GetAccessorDeclaration 980 | SetAccessorDeclaration 981 | ClassStaticBlockDeclaration 982 | CallSignatureDeclaration 983 | ConstructSignatureDeclaration 984 | IndexSignatureDeclaration 985 | TypePredicateNode 986 | TypeReferenceNode 987 | FunctionTypeNode 988 | ConstructorTypeNode 989 | TypeQueryNode 990 | TypeLiteralNode 991 | ArrayTypeNode 992 | TupleTypeNode 993 | OptionalTypeNode 994 | RestTypeNode 995 | UnionTypeNode 996 | IntersectionTypeNode 997 | ConditionalTypeNode 998 | InferTypeNode 999 | ImportTypeNode 1000 | ImportTypeAssertionContainer 1001 | NamedTupleMember 1002 | ParenthesizedTypeNode 1003 | TypeOperatorNode 1004 | IndexedAccessTypeNode 1005 | MappedTypeNode 1006 | LiteralTypeNode 1007 | TemplateLiteralTypeNode 1008 | TemplateLiteralTypeSpan 1009 | ObjectBindingPattern 1010 | ArrayBindingPattern 1011 | BindingElement 1012 | ArrayLiteralExpression 1013 | ObjectLiteralExpression 1014 | PropertyAccessExpression 1015 | ElementAccessExpression 1016 | CallExpression 1017 | EtsComponentExpression 1018 | NewExpression 1019 | TaggedTemplateExpression 1020 | TypeAssertion 1021 | ParenthesizedExpression 1022 | FunctionExpression 1023 | ArrowFunction 1024 | DeleteExpression 1025 | TypeOfExpression 1026 | VoidExpression 1027 | AwaitExpression 1028 | PrefixUnaryExpression 1029 | PostfixUnaryExpression 1030 | BinaryExpression 1031 | ConditionalExpression 1032 | TemplateExpression 1033 | YieldExpression 1034 | SpreadElement 1035 | ClassExpression 1036 | ExpressionWithTypeArguments 1037 | AsExpression 1038 | NonNullExpression 1039 | SatisfiesExpression 1040 | MetaProperty 1041 | TemplateSpan 1042 | Block 1043 | VariableStatement 1044 | ExpressionStatement 1045 | IfStatement 1046 | DoStatement 1047 | WhileStatement 1048 | ForStatement 1049 | ForInStatement 1050 | ForOfStatement 1051 | ContinueStatement 1052 | BreakStatement 1053 | ReturnStatement 1054 | WithStatement 1055 | SwitchStatement 1056 | LabeledStatement 1057 | ThrowStatement 1058 | TryStatement 1059 | VariableDeclaration 1060 | VariableDeclarationList 1061 | FunctionDeclaration 1062 | ClassDeclaration 1063 | StructDeclaration 1064 | InterfaceDeclaration 1065 | TypeAliasDeclaration 1066 | EnumDeclaration 1067 | ModuleDeclaration 1068 | ModuleBlock 1069 | CaseBlock 1070 | NamespaceExportDeclaration 1071 | ImportEqualsDeclaration 1072 | ImportDeclaration 1073 | AssertClause 1074 | AssertEntry 1075 | ImportClause 1076 | NamespaceImport 1077 | NamespaceExport 1078 | NamedImports 1079 | ImportSpecifier 1080 | ExportAssignment 1081 | ExportDeclaration 1082 | NamedExports 1083 | ExportSpecifier 1084 | ExternalModuleReference 1085 | JsxElement 1086 | JsxSelfClosingElement 1087 | JsxOpeningElement 1088 | JsxClosingElement 1089 | JsxFragment 1090 | JsxAttribute 1091 | JsxAttributes 1092 | JsxSpreadAttribute 1093 | JsxExpression 1094 | CaseClause 1095 | DefaultClause 1096 | HeritageClause 1097 | CatchClause 1098 | PropertyAssignment 1099 | ShorthandPropertyAssignment 1100 | SpreadAssignment 1101 | EnumMember 1102 | SourceFile 1103 | PartiallyEmittedExpression 1104 | CommaListExpression 1105 ; 1106 1107 export type HasJSDoc = 1108 | ParameterDeclaration 1109 | CallSignatureDeclaration 1110 | ClassStaticBlockDeclaration 1111 | ConstructSignatureDeclaration 1112 | MethodSignature 1113 | PropertySignature 1114 | ArrowFunction 1115 | ParenthesizedExpression 1116 | SpreadAssignment 1117 | ShorthandPropertyAssignment 1118 | PropertyAssignment 1119 | FunctionExpression 1120 | EmptyStatement 1121 | DebuggerStatement 1122 | Block 1123 | VariableStatement 1124 | ExpressionStatement 1125 | IfStatement 1126 | DoStatement 1127 | WhileStatement 1128 | ForStatement 1129 | ForInStatement 1130 | ForOfStatement 1131 | BreakStatement 1132 | ContinueStatement 1133 | ReturnStatement 1134 | WithStatement 1135 | SwitchStatement 1136 | LabeledStatement 1137 | ThrowStatement 1138 | TryStatement 1139 | FunctionDeclaration 1140 | ConstructorDeclaration 1141 | MethodDeclaration 1142 | VariableDeclaration 1143 | PropertyDeclaration 1144 | AccessorDeclaration 1145 | ClassLikeDeclaration 1146 | InterfaceDeclaration 1147 | TypeAliasDeclaration 1148 | EnumMember 1149 | EnumDeclaration 1150 | ModuleDeclaration 1151 | ImportEqualsDeclaration 1152 | ImportDeclaration 1153 | NamespaceExportDeclaration 1154 | ExportAssignment 1155 | IndexSignatureDeclaration 1156 | FunctionTypeNode 1157 | ConstructorTypeNode 1158 | JSDocFunctionType 1159 | ExportDeclaration 1160 | NamedTupleMember 1161 | ExportSpecifier 1162 | CaseClause 1163 | EndOfFileToken 1164 ; 1165 1166 export type HasType = 1167 | SignatureDeclaration 1168 | VariableDeclaration 1169 | ParameterDeclaration 1170 | PropertySignature 1171 | PropertyDeclaration 1172 | TypePredicateNode 1173 | ParenthesizedTypeNode 1174 | TypeOperatorNode 1175 | MappedTypeNode 1176 | AssertionExpression 1177 | TypeAliasDeclaration 1178 | JSDocTypeExpression 1179 | JSDocNonNullableType 1180 | JSDocNullableType 1181 | JSDocOptionalType 1182 | JSDocVariadicType 1183 ; 1184 1185 // NOTE: Changing the following list requires changes to: 1186 // - `canHaveIllegalType` in factory/utilities.ts 1187 /* @internal */ 1188 export type HasIllegalType = 1189 | ConstructorDeclaration 1190 | SetAccessorDeclaration 1191 ; 1192 1193 // NOTE: Changing the following list requires changes to: 1194 // - `canHaveIllegalTypeParameters` in factory/utilities.ts 1195 /* @internal */ 1196 export type HasIllegalTypeParameters = 1197 | ConstructorDeclaration 1198 | SetAccessorDeclaration 1199 | GetAccessorDeclaration 1200 ; 1201 1202 export type HasTypeArguments = 1203 | CallExpression 1204 | NewExpression 1205 | TaggedTemplateExpression 1206 | JsxOpeningElement 1207 | JsxSelfClosingElement; 1208 1209 export type HasInitializer = 1210 | HasExpressionInitializer 1211 | ForStatement 1212 | ForInStatement 1213 | ForOfStatement 1214 | JsxAttribute 1215 ; 1216 1217 export type HasExpressionInitializer = 1218 | VariableDeclaration 1219 | ParameterDeclaration 1220 | BindingElement 1221 | PropertyDeclaration 1222 | PropertyAssignment 1223 | EnumMember 1224 ; 1225 1226 /* @internal */ 1227 export type HasIllegalExpressionInitializer = 1228 | PropertySignature 1229 ; 1230 1231 // NOTE: Changing the following list requires changes to: 1232 // - `canHaveDecorators` in factory/utilities.ts 1233 // - `updateModifiers` in factory/nodeFactory.ts 1234 export type HasDecorators = 1235 | ParameterDeclaration 1236 | PropertyDeclaration 1237 | MethodDeclaration 1238 | GetAccessorDeclaration 1239 | SetAccessorDeclaration 1240 | ClassExpression 1241 | ClassDeclaration 1242 | StructDeclaration 1243 | FunctionDeclaration 1244 ; 1245 1246 // NOTE: Changing the following list requires changes to: 1247 // - `canHaveIllegalDecorators` in factory/utilities.ts 1248 export type HasIllegalDecorators = 1249 | PropertyAssignment 1250 | ShorthandPropertyAssignment 1251 | FunctionDeclaration 1252 | ConstructorDeclaration 1253 | IndexSignatureDeclaration 1254 | ClassStaticBlockDeclaration 1255 | MissingDeclaration 1256 | VariableStatement 1257 | InterfaceDeclaration 1258 | TypeAliasDeclaration 1259 | EnumDeclaration 1260 | ModuleDeclaration 1261 | ImportEqualsDeclaration 1262 | ImportDeclaration 1263 | NamespaceExportDeclaration 1264 | ExportDeclaration 1265 | ExportAssignment 1266 ; 1267 1268 // NOTE: Changing the following list requires changes to: 1269 // - `canHaveModifiers` in factory/utilities.ts 1270 // - `updateModifiers` in factory/nodeFactory.ts 1271 export type HasModifiers = 1272 | TypeParameterDeclaration 1273 | ParameterDeclaration 1274 | ConstructorTypeNode 1275 | PropertySignature 1276 | PropertyDeclaration 1277 | MethodSignature 1278 | MethodDeclaration 1279 | ConstructorDeclaration 1280 | GetAccessorDeclaration 1281 | SetAccessorDeclaration 1282 | IndexSignatureDeclaration 1283 | FunctionExpression 1284 | ArrowFunction 1285 | ClassExpression 1286 | VariableStatement 1287 | FunctionDeclaration 1288 | ClassDeclaration 1289 | StructDeclaration 1290 | InterfaceDeclaration 1291 | TypeAliasDeclaration 1292 | EnumDeclaration 1293 | ModuleDeclaration 1294 | ImportEqualsDeclaration 1295 | ImportDeclaration 1296 | ExportAssignment 1297 | ExportDeclaration 1298 ; 1299 1300 // NOTE: Changing the following list requires changes to: 1301 // - `canHaveIllegalModifiers` in factory/utilities.ts 1302 /* @internal */ 1303 export type HasIllegalModifiers = 1304 | ClassStaticBlockDeclaration 1305 | PropertyAssignment 1306 | ShorthandPropertyAssignment 1307 | MissingDeclaration 1308 | FunctionTypeNode 1309 | NamespaceExportDeclaration 1310 ; 1311 1312 /* @internal */ 1313 export interface MutableNodeArray<T extends Node> extends Array<T>, TextRange { 1314 hasTrailingComma: boolean; 1315 /* @internal */ transformFlags: TransformFlags; // Flags for transforms, possibly undefined 1316 } 1317 1318 export interface NodeArray<T extends Node> extends ReadonlyArray<T>, ReadonlyTextRange { 1319 readonly hasTrailingComma: boolean; 1320 /* @internal */ transformFlags: TransformFlags; // Flags for transforms, possibly undefined 1321 } 1322 1323 // TODO(rbuckton): Constraint 'TKind' to 'TokenSyntaxKind' 1324 export interface Token<TKind extends SyntaxKind> extends Node { 1325 readonly kind: TKind; 1326 } 1327 1328 export type EndOfFileToken = Token<SyntaxKind.EndOfFileToken> & JSDocContainer; 1329 1330 // Punctuation 1331 export interface PunctuationToken<TKind extends PunctuationSyntaxKind> extends Token<TKind> { 1332 } 1333 1334 export type DotToken = PunctuationToken<SyntaxKind.DotToken>; 1335 export type DotDotDotToken = PunctuationToken<SyntaxKind.DotDotDotToken>; 1336 export type QuestionToken = PunctuationToken<SyntaxKind.QuestionToken>; 1337 export type ExclamationToken = PunctuationToken<SyntaxKind.ExclamationToken>; 1338 export type ColonToken = PunctuationToken<SyntaxKind.ColonToken>; 1339 export type EqualsToken = PunctuationToken<SyntaxKind.EqualsToken>; 1340 export type AsteriskToken = PunctuationToken<SyntaxKind.AsteriskToken>; 1341 export type EqualsGreaterThanToken = PunctuationToken<SyntaxKind.EqualsGreaterThanToken>; 1342 export type PlusToken = PunctuationToken<SyntaxKind.PlusToken>; 1343 export type MinusToken = PunctuationToken<SyntaxKind.MinusToken>; 1344 export type QuestionDotToken = PunctuationToken<SyntaxKind.QuestionDotToken>; 1345 1346 // Keywords 1347 export interface KeywordToken<TKind extends KeywordSyntaxKind> extends Token<TKind> { 1348 } 1349 1350 export type AssertsKeyword = KeywordToken<SyntaxKind.AssertsKeyword>; 1351 export type AssertKeyword = KeywordToken<SyntaxKind.AssertKeyword>; 1352 export type AwaitKeyword = KeywordToken<SyntaxKind.AwaitKeyword>; 1353 1354 /** @deprecated Use `AwaitKeyword` instead. */ 1355 export type AwaitKeywordToken = AwaitKeyword; 1356 1357 /** @deprecated Use `AssertsKeyword` instead. */ 1358 export type AssertsToken = AssertsKeyword; 1359 1360 export interface ModifierToken<TKind extends ModifierSyntaxKind> extends KeywordToken<TKind> { 1361 } 1362 1363 export type AbstractKeyword = ModifierToken<SyntaxKind.AbstractKeyword>; 1364 export type AccessorKeyword = ModifierToken<SyntaxKind.AccessorKeyword>; 1365 export type AsyncKeyword = ModifierToken<SyntaxKind.AsyncKeyword>; 1366 export type ConstKeyword = ModifierToken<SyntaxKind.ConstKeyword>; 1367 export type DeclareKeyword = ModifierToken<SyntaxKind.DeclareKeyword>; 1368 export type DefaultKeyword = ModifierToken<SyntaxKind.DefaultKeyword>; 1369 export type ExportKeyword = ModifierToken<SyntaxKind.ExportKeyword>; 1370 export type InKeyword = ModifierToken<SyntaxKind.InKeyword>; 1371 export type PrivateKeyword = ModifierToken<SyntaxKind.PrivateKeyword>; 1372 export type ProtectedKeyword = ModifierToken<SyntaxKind.ProtectedKeyword>; 1373 export type PublicKeyword = ModifierToken<SyntaxKind.PublicKeyword>; 1374 export type ReadonlyKeyword = ModifierToken<SyntaxKind.ReadonlyKeyword>; 1375 export type OutKeyword = ModifierToken<SyntaxKind.OutKeyword>; 1376 export type OverrideKeyword = ModifierToken<SyntaxKind.OverrideKeyword>; 1377 export type StaticKeyword = ModifierToken<SyntaxKind.StaticKeyword>; 1378 1379 /** @deprecated Use `ReadonlyKeyword` instead. */ 1380 export type ReadonlyToken = ReadonlyKeyword; 1381 1382 export type Modifier = 1383 | AbstractKeyword 1384 | AccessorKeyword 1385 | AsyncKeyword 1386 | ConstKeyword 1387 | DeclareKeyword 1388 | DefaultKeyword 1389 | ExportKeyword 1390 | InKeyword 1391 | PrivateKeyword 1392 | ProtectedKeyword 1393 | PublicKeyword 1394 | OutKeyword 1395 | OverrideKeyword 1396 | ReadonlyKeyword 1397 | StaticKeyword 1398 ; 1399 1400 export type ModifierLike = Modifier | Decorator; 1401 1402 export type AccessibilityModifier = 1403 | PublicKeyword 1404 | PrivateKeyword 1405 | ProtectedKeyword 1406 ; 1407 1408 export type ParameterPropertyModifier = 1409 | AccessibilityModifier 1410 | ReadonlyKeyword 1411 ; 1412 1413 export type ClassMemberModifier = 1414 | AccessibilityModifier 1415 | ReadonlyKeyword 1416 | StaticKeyword 1417 | AccessorKeyword 1418 ; 1419 1420 export type ModifiersArray = NodeArray<Modifier>; 1421 1422 export const enum GeneratedIdentifierFlags { 1423 // Kinds 1424 None = 0, // Not automatically generated. 1425 /*@internal*/ Auto = 1, // Automatically generated identifier. 1426 /*@internal*/ Loop = 2, // Automatically generated identifier with a preference for '_i'. 1427 /*@internal*/ Unique = 3, // Unique name based on the 'text' property. 1428 /*@internal*/ Node = 4, // Unique name based on the node in the 'original' property. 1429 /*@internal*/ KindMask = 7, // Mask to extract the kind of identifier from its flags. 1430 1431 // Flags 1432 ReservedInNestedScopes = 1 << 3, // Reserve the generated name in nested scopes 1433 Optimistic = 1 << 4, // First instance won't use '_#' if there's no conflict 1434 FileLevel = 1 << 5, // Use only the file identifiers list and not generated names to search for conflicts 1435 AllowNameSubstitution = 1 << 6, // Used by `module.ts` to indicate generated nodes which can have substitutions performed upon them (as they were generated by an earlier transform phase) 1436 } 1437 1438 export interface Identifier extends PrimaryExpression, Declaration { 1439 readonly kind: SyntaxKind.Identifier; 1440 /** 1441 * Prefer to use `id.unescapedText`. (Note: This is available only in services, not internally to the TypeScript compiler.) 1442 * Text of identifier, but if the identifier begins with two underscores, this will begin with three. 1443 */ 1444 readonly escapedText: __String; 1445 readonly originalKeywordKind?: SyntaxKind; // Original syntaxKind which get set so that we can report an error later 1446 /*@internal*/ readonly autoGenerateFlags?: GeneratedIdentifierFlags; // Specifies whether to auto-generate the text for an identifier. 1447 /*@internal*/ readonly autoGenerateId?: number; // Ensures unique generated identifiers get unique names, but clones get the same name. 1448 /*@internal*/ readonly autoGeneratePrefix?: string | GeneratedNamePart; 1449 /*@internal*/ readonly autoGenerateSuffix?: string; 1450 /*@internal*/ generatedImportReference?: ImportSpecifier; // Reference to the generated import specifier this identifier refers to 1451 isInJSDocNamespace?: boolean; // if the node is a member in a JSDoc namespace 1452 /*@internal*/ typeArguments?: NodeArray<TypeNode | TypeParameterDeclaration>; // Only defined on synthesized nodes. Though not syntactically valid, used in emitting diagnostics, quickinfo, and signature help. 1453 /*@internal*/ jsdocDotPos?: number; // Identifier occurs in JSDoc-style generic: Id.<T> 1454 /*@internal*/ hasExtendedUnicodeEscape?: boolean; 1455 } 1456 1457 // Transient identifier node (marked by id === -1) 1458 export interface TransientIdentifier extends Identifier { 1459 resolvedSymbol: Symbol; 1460 } 1461 1462 /*@internal*/ 1463 export interface GeneratedIdentifier extends Identifier { 1464 autoGenerateFlags: GeneratedIdentifierFlags; 1465 } 1466 1467 export interface QualifiedName extends Node { 1468 readonly kind: SyntaxKind.QualifiedName; 1469 readonly left: EntityName; 1470 readonly right: Identifier; 1471 /*@internal*/ jsdocDotPos?: number; // QualifiedName occurs in JSDoc-style generic: Id1.Id2.<T> 1472 } 1473 1474 export type EntityName = Identifier | QualifiedName; 1475 1476 export type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier; 1477 1478 export type MemberName = Identifier | PrivateIdentifier; 1479 1480 export type DeclarationName = 1481 | Identifier 1482 | PrivateIdentifier 1483 | StringLiteralLike 1484 | NumericLiteral 1485 | ComputedPropertyName 1486 | ElementAccessExpression 1487 | BindingPattern 1488 | EntityNameExpression; 1489 1490 export interface Declaration extends Node { 1491 _declarationBrand: any; 1492 } 1493 1494 export interface NamedDeclaration extends Declaration { 1495 readonly name?: DeclarationName; 1496 } 1497 1498 /* @internal */ 1499 export interface DynamicNamedDeclaration extends NamedDeclaration { 1500 readonly name: ComputedPropertyName; 1501 } 1502 1503 /* @internal */ 1504 export interface DynamicNamedBinaryExpression extends BinaryExpression { 1505 readonly left: ElementAccessExpression; 1506 } 1507 1508 /* @internal */ 1509 // A declaration that supports late-binding (used in checker) 1510 export interface LateBoundDeclaration extends DynamicNamedDeclaration { 1511 readonly name: LateBoundName; 1512 } 1513 1514 /* @internal */ 1515 export interface LateBoundBinaryExpressionDeclaration extends DynamicNamedBinaryExpression { 1516 readonly left: LateBoundElementAccessExpression; 1517 } 1518 1519 /* @internal */ 1520 export interface LateBoundElementAccessExpression extends ElementAccessExpression { 1521 readonly argumentExpression: EntityNameExpression; 1522 } 1523 1524 export interface DeclarationStatement extends NamedDeclaration, Statement { 1525 readonly name?: Identifier | StringLiteral | NumericLiteral; 1526 } 1527 1528 export interface ComputedPropertyName extends Node { 1529 readonly kind: SyntaxKind.ComputedPropertyName; 1530 readonly parent: Declaration; 1531 readonly expression: Expression; 1532 } 1533 1534 // Typed as a PrimaryExpression due to its presence in BinaryExpressions (#field in expr) 1535 export interface PrivateIdentifier extends PrimaryExpression { 1536 readonly kind: SyntaxKind.PrivateIdentifier; 1537 // escaping not strictly necessary 1538 // avoids gotchas in transforms and utils 1539 readonly escapedText: __String; 1540 /*@internal*/ readonly autoGenerateFlags?: GeneratedIdentifierFlags; // Specifies whether to auto-generate the text for an identifier. 1541 /*@internal*/ readonly autoGenerateId?: number; // Ensures unique generated identifiers get unique names, but clones get the same name. 1542 /*@internal*/ readonly autoGeneratePrefix?: string | GeneratedNamePart; 1543 /*@internal*/ readonly autoGenerateSuffix?: string; 1544 } 1545 1546 /*@internal*/ 1547 export interface GeneratedPrivateIdentifier extends PrivateIdentifier { 1548 autoGenerateFlags: GeneratedIdentifierFlags; 1549 } 1550 1551 /* @internal */ 1552 // A name that supports late-binding (used in checker) 1553 export interface LateBoundName extends ComputedPropertyName { 1554 readonly expression: EntityNameExpression; 1555 } 1556 1557 export interface Decorator extends Node { 1558 readonly kind: SyntaxKind.Decorator; 1559 readonly parent: NamedDeclaration; 1560 readonly expression: LeftHandSideExpression; 1561 } 1562 1563 export interface TypeParameterDeclaration extends NamedDeclaration { 1564 readonly kind: SyntaxKind.TypeParameter; 1565 readonly parent: DeclarationWithTypeParameterChildren | InferTypeNode; 1566 readonly modifiers?: NodeArray<Modifier>; 1567 readonly name: Identifier; 1568 /** Note: Consider calling `getEffectiveConstraintOfTypeParameter` */ 1569 readonly constraint?: TypeNode; 1570 readonly default?: TypeNode; 1571 1572 // For error recovery purposes. 1573 expression?: Expression; 1574 } 1575 1576 export interface SignatureDeclarationBase extends NamedDeclaration, JSDocContainer { 1577 readonly kind: SignatureDeclaration["kind"]; 1578 readonly name?: PropertyName; 1579 readonly typeParameters?: NodeArray<TypeParameterDeclaration> | undefined; 1580 readonly parameters: NodeArray<ParameterDeclaration>; 1581 readonly type?: TypeNode | undefined; 1582 /* @internal */ typeArguments?: NodeArray<TypeNode>; // Used for quick info, replaces typeParameters for instantiated signatures 1583 } 1584 1585 export type SignatureDeclaration = 1586 | CallSignatureDeclaration 1587 | ConstructSignatureDeclaration 1588 | MethodSignature 1589 | IndexSignatureDeclaration 1590 | FunctionTypeNode 1591 | ConstructorTypeNode 1592 | JSDocFunctionType 1593 | FunctionDeclaration 1594 | MethodDeclaration 1595 | ConstructorDeclaration 1596 | AccessorDeclaration 1597 | FunctionExpression 1598 | ArrowFunction; 1599 1600 export interface CallSignatureDeclaration extends SignatureDeclarationBase, TypeElement { 1601 readonly kind: SyntaxKind.CallSignature; 1602 } 1603 1604 export interface ConstructSignatureDeclaration extends SignatureDeclarationBase, TypeElement { 1605 readonly kind: SyntaxKind.ConstructSignature; 1606 } 1607 1608 export type BindingName = Identifier | BindingPattern; 1609 1610 export interface VariableDeclaration extends NamedDeclaration, JSDocContainer { 1611 readonly kind: SyntaxKind.VariableDeclaration; 1612 readonly parent: VariableDeclarationList | CatchClause; 1613 readonly name: BindingName; // Declared variable name 1614 readonly exclamationToken?: ExclamationToken; // Optional definite assignment assertion 1615 readonly type?: TypeNode; // Optional type annotation 1616 readonly initializer?: Expression; // Optional initializer 1617 } 1618 1619 /* @internal */ 1620 export type InitializedVariableDeclaration = VariableDeclaration & { readonly initializer: Expression }; 1621 1622 export interface VariableDeclarationList extends Node { 1623 readonly kind: SyntaxKind.VariableDeclarationList; 1624 readonly parent: VariableStatement | ForStatement | ForOfStatement | ForInStatement; 1625 readonly declarations: NodeArray<VariableDeclaration>; 1626 } 1627 1628 export interface ParameterDeclaration extends NamedDeclaration, JSDocContainer { 1629 readonly kind: SyntaxKind.Parameter; 1630 readonly parent: SignatureDeclaration; 1631 readonly modifiers?: NodeArray<ModifierLike>; 1632 readonly dotDotDotToken?: DotDotDotToken; // Present on rest parameter 1633 readonly name: BindingName; // Declared parameter name. 1634 readonly questionToken?: QuestionToken; // Present on optional parameter 1635 readonly type?: TypeNode; // Optional type annotation 1636 readonly initializer?: Expression; // Optional initializer 1637 } 1638 1639 export interface BindingElement extends NamedDeclaration { 1640 readonly kind: SyntaxKind.BindingElement; 1641 readonly parent: BindingPattern; 1642 readonly propertyName?: PropertyName; // Binding property name (in object binding pattern) 1643 readonly dotDotDotToken?: DotDotDotToken; // Present on rest element (in object binding pattern) 1644 readonly name: BindingName; // Declared binding element name 1645 readonly initializer?: Expression; // Optional initializer 1646 } 1647 1648 /*@internal*/ 1649 export type BindingElementGrandparent = BindingElement["parent"]["parent"]; 1650 1651 export interface PropertySignature extends TypeElement, JSDocContainer { 1652 readonly kind: SyntaxKind.PropertySignature; 1653 readonly modifiers?: NodeArray<Modifier>; 1654 readonly name: PropertyName; // Declared property name 1655 readonly questionToken?: QuestionToken; // Present on optional property 1656 readonly type?: TypeNode; // Optional type annotation 1657 1658 // The following properties are used only to report grammar errors 1659 /* @internal */ readonly initializer?: Expression | undefined; // A property signature cannot have an initializer 1660 } 1661 1662 export interface PropertyDeclaration extends ClassElement, JSDocContainer { 1663 readonly kind: SyntaxKind.PropertyDeclaration; 1664 readonly parent: ClassLikeDeclaration; 1665 readonly modifiers?: NodeArray<ModifierLike>; 1666 readonly name: PropertyName; 1667 readonly questionToken?: QuestionToken; // Present for use with reporting a grammar error 1668 readonly exclamationToken?: ExclamationToken; 1669 readonly type?: TypeNode; 1670 readonly initializer?: Expression; // Optional initializer 1671 } 1672 1673 export interface AutoAccessorPropertyDeclaration extends PropertyDeclaration { 1674 _autoAccessorBrand: any; 1675 } 1676 1677 /*@internal*/ 1678 export interface PrivateIdentifierPropertyDeclaration extends PropertyDeclaration { 1679 name: PrivateIdentifier; 1680 } 1681 /*@internal*/ 1682 export interface PrivateIdentifierAutoAccessorPropertyDeclaration extends AutoAccessorPropertyDeclaration { 1683 name: PrivateIdentifier; 1684 } 1685 /*@internal*/ 1686 export interface PrivateIdentifierMethodDeclaration extends MethodDeclaration { 1687 name: PrivateIdentifier; 1688 } 1689 /*@internal*/ 1690 export interface PrivateIdentifierGetAccessorDeclaration extends GetAccessorDeclaration { 1691 name: PrivateIdentifier; 1692 } 1693 /*@internal*/ 1694 export interface PrivateIdentifierSetAccessorDeclaration extends SetAccessorDeclaration { 1695 name: PrivateIdentifier; 1696 } 1697 /*@internal*/ 1698 export type PrivateIdentifierAccessorDeclaration = PrivateIdentifierGetAccessorDeclaration | PrivateIdentifierSetAccessorDeclaration; 1699 /*@internal*/ 1700 export type PrivateClassElementDeclaration = 1701 | PrivateIdentifierPropertyDeclaration 1702 | PrivateIdentifierAutoAccessorPropertyDeclaration 1703 | PrivateIdentifierMethodDeclaration 1704 | PrivateIdentifierGetAccessorDeclaration 1705 | PrivateIdentifierSetAccessorDeclaration; 1706 1707 /* @internal */ 1708 export type InitializedPropertyDeclaration = PropertyDeclaration & { readonly initializer: Expression }; 1709 1710 export interface ObjectLiteralElement extends NamedDeclaration { 1711 _objectLiteralBrand: any; 1712 readonly name?: PropertyName; 1713 } 1714 1715 /** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */ 1716 export type ObjectLiteralElementLike 1717 = PropertyAssignment 1718 | ShorthandPropertyAssignment 1719 | SpreadAssignment 1720 | MethodDeclaration 1721 | AccessorDeclaration 1722 ; 1723 1724 export interface PropertyAssignment extends ObjectLiteralElement, JSDocContainer { 1725 readonly kind: SyntaxKind.PropertyAssignment; 1726 readonly parent: ObjectLiteralExpression; 1727 readonly name: PropertyName; 1728 readonly initializer: Expression; 1729 1730 // The following properties are used only to report grammar errors 1731 /* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; // property assignment cannot have decorators 1732 /* @internal */ readonly modifiers?: NodeArray<Modifier> | undefined; // property assignment cannot have modifiers 1733 /* @internal */ readonly questionToken?: QuestionToken | undefined; // property assignment cannot have a question token 1734 /* @internal */ readonly exclamationToken?: ExclamationToken | undefined; // property assignment cannot have an exclamation token 1735 } 1736 1737 export interface ShorthandPropertyAssignment extends ObjectLiteralElement, JSDocContainer { 1738 readonly kind: SyntaxKind.ShorthandPropertyAssignment; 1739 readonly parent: ObjectLiteralExpression; 1740 readonly name: Identifier; 1741 // used when ObjectLiteralExpression is used in ObjectAssignmentPattern 1742 // it is a grammar error to appear in actual object initializer: 1743 readonly equalsToken?: EqualsToken; 1744 readonly objectAssignmentInitializer?: Expression; 1745 1746 // The following properties are used only to report grammar errors 1747 /* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; // shorthand property assignment cannot have decorators 1748 /* @internal */ readonly modifiers?: NodeArray<Modifier> | undefined; // shorthand property assignment cannot have modifiers 1749 /* @internal */ readonly questionToken?: QuestionToken | undefined; // shorthand property assignment cannot have a question token 1750 /* @internal */ readonly exclamationToken?: ExclamationToken | undefined; // shorthand property assignment cannot have an exclamation token 1751 } 1752 1753 export interface SpreadAssignment extends ObjectLiteralElement, JSDocContainer { 1754 readonly kind: SyntaxKind.SpreadAssignment; 1755 readonly parent: ObjectLiteralExpression; 1756 readonly expression: Expression; 1757 } 1758 1759 export type VariableLikeDeclaration = 1760 | VariableDeclaration 1761 | ParameterDeclaration 1762 | BindingElement 1763 | PropertyDeclaration 1764 | PropertyAssignment 1765 | PropertySignature 1766 | JsxAttribute 1767 | ShorthandPropertyAssignment 1768 | EnumMember 1769 | JSDocPropertyTag 1770 | JSDocParameterTag; 1771 1772 export interface PropertyLikeDeclaration extends NamedDeclaration { 1773 readonly name: PropertyName; 1774 } 1775 1776 export interface ObjectBindingPattern extends Node { 1777 readonly kind: SyntaxKind.ObjectBindingPattern; 1778 readonly parent: VariableDeclaration | ParameterDeclaration | BindingElement; 1779 readonly elements: NodeArray<BindingElement>; 1780 } 1781 1782 export interface ArrayBindingPattern extends Node { 1783 readonly kind: SyntaxKind.ArrayBindingPattern; 1784 readonly parent: VariableDeclaration | ParameterDeclaration | BindingElement; 1785 readonly elements: NodeArray<ArrayBindingElement>; 1786 } 1787 1788 export type BindingPattern = ObjectBindingPattern | ArrayBindingPattern; 1789 1790 export type ArrayBindingElement = BindingElement | OmittedExpression; 1791 1792 /** 1793 * Several node kinds share function-like features such as a signature, 1794 * a name, and a body. These nodes should extend FunctionLikeDeclarationBase. 1795 * Examples: 1796 * - FunctionDeclaration 1797 * - MethodDeclaration 1798 * - AccessorDeclaration 1799 */ 1800 export interface FunctionLikeDeclarationBase extends SignatureDeclarationBase { 1801 _functionLikeDeclarationBrand: any; 1802 1803 readonly asteriskToken?: AsteriskToken | undefined; 1804 readonly questionToken?: QuestionToken | undefined; 1805 readonly exclamationToken?: ExclamationToken | undefined; 1806 readonly body?: Block | Expression | undefined; 1807 /* @internal */ endFlowNode?: FlowNode; 1808 /* @internal */ returnFlowNode?: FlowNode; 1809 } 1810 1811 export type FunctionLikeDeclaration = 1812 | FunctionDeclaration 1813 | MethodDeclaration 1814 | GetAccessorDeclaration 1815 | SetAccessorDeclaration 1816 | ConstructorDeclaration 1817 | FunctionExpression 1818 | ArrowFunction; 1819 /** @deprecated Use SignatureDeclaration */ 1820 export type FunctionLike = SignatureDeclaration; 1821 1822 export interface FunctionDeclaration extends FunctionLikeDeclarationBase, DeclarationStatement { 1823 readonly kind: SyntaxKind.FunctionDeclaration; 1824 readonly modifiers?: NodeArray<Modifier>; 1825 readonly name?: Identifier; 1826 readonly body?: FunctionBody; 1827 1828 // The following properties are used only to report grammar errors 1829 /* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; // functions cannot have decorators 1830 } 1831 1832 export interface MethodSignature extends SignatureDeclarationBase, TypeElement { 1833 readonly kind: SyntaxKind.MethodSignature; 1834 readonly parent: ObjectTypeDeclaration; 1835 readonly modifiers?: NodeArray<Modifier>; 1836 readonly name: PropertyName; 1837 } 1838 1839 // Note that a MethodDeclaration is considered both a ClassElement and an ObjectLiteralElement. 1840 // Both the grammars for ClassDeclaration and ObjectLiteralExpression allow for MethodDeclarations 1841 // as child elements, and so a MethodDeclaration satisfies both interfaces. This avoids the 1842 // alternative where we would need separate kinds/types for ClassMethodDeclaration and 1843 // ObjectLiteralMethodDeclaration, which would look identical. 1844 // 1845 // Because of this, it may be necessary to determine what sort of MethodDeclaration you have 1846 // at later stages of the compiler pipeline. In that case, you can either check the parent kind 1847 // of the method, or use helpers like isObjectLiteralMethodDeclaration 1848 export interface MethodDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer { 1849 readonly kind: SyntaxKind.MethodDeclaration; 1850 readonly parent: ClassLikeDeclaration | ObjectLiteralExpression; 1851 readonly modifiers?: NodeArray<ModifierLike> | undefined; 1852 readonly name: PropertyName; 1853 readonly body?: FunctionBody | undefined; 1854 1855 // The following properties are used only to report grammar errors 1856 /* @internal */ readonly exclamationToken?: ExclamationToken | undefined; // A method cannot have an exclamation token 1857 } 1858 1859 export interface ConstructorDeclaration extends FunctionLikeDeclarationBase, ClassElement, JSDocContainer { 1860 readonly kind: SyntaxKind.Constructor; 1861 readonly parent: ClassLikeDeclaration; 1862 readonly modifiers?: NodeArray<Modifier> | undefined; 1863 readonly body?: FunctionBody | undefined; 1864 1865 // The following properties are used only to report grammar errors 1866 /* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; // A constructor cannot have decorators 1867 /* @internal */ readonly typeParameters?: NodeArray<TypeParameterDeclaration>; // A constructor cannot have type parameters 1868 /* @internal */ readonly type?: TypeNode; // A constructor cannot have a return type annotation 1869 } 1870 1871 /** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */ 1872 export interface SemicolonClassElement extends ClassElement { 1873 readonly kind: SyntaxKind.SemicolonClassElement; 1874 readonly parent: ClassLikeDeclaration; 1875 } 1876 1877 // See the comment on MethodDeclaration for the intuition behind GetAccessorDeclaration being a 1878 // ClassElement and an ObjectLiteralElement. 1879 export interface GetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, TypeElement, ObjectLiteralElement, JSDocContainer { 1880 readonly kind: SyntaxKind.GetAccessor; 1881 readonly parent: ClassLikeDeclaration | ObjectLiteralExpression | TypeLiteralNode | InterfaceDeclaration; 1882 readonly modifiers?: NodeArray<ModifierLike>; 1883 readonly name: PropertyName; 1884 readonly body?: FunctionBody; 1885 1886 // The following properties are used only to report grammar errors 1887 /* @internal */ readonly typeParameters?: NodeArray<TypeParameterDeclaration> | undefined; // A get accessor cannot have type parameters 1888 } 1889 1890 // See the comment on MethodDeclaration for the intuition behind SetAccessorDeclaration being a 1891 // ClassElement and an ObjectLiteralElement. 1892 export interface SetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, TypeElement, ObjectLiteralElement, JSDocContainer { 1893 readonly kind: SyntaxKind.SetAccessor; 1894 readonly parent: ClassLikeDeclaration | ObjectLiteralExpression | TypeLiteralNode | InterfaceDeclaration; 1895 readonly modifiers?: NodeArray<ModifierLike>; 1896 readonly name: PropertyName; 1897 readonly body?: FunctionBody; 1898 1899 // The following properties are used only to report grammar errors 1900 /* @internal */ readonly typeParameters?: NodeArray<TypeParameterDeclaration> | undefined; // A set accessor cannot have type parameters 1901 /* @internal */ readonly type?: TypeNode | undefined; // A set accessor cannot have a return type 1902 } 1903 1904 export type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration; 1905 1906 export interface IndexSignatureDeclaration extends SignatureDeclarationBase, ClassElement, TypeElement { 1907 readonly kind: SyntaxKind.IndexSignature; 1908 readonly parent: ObjectTypeDeclaration; 1909 readonly modifiers?: NodeArray<Modifier>; 1910 readonly type: TypeNode; 1911 1912 // The following properties are used only to report grammar errors 1913 /* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; 1914 } 1915 1916 export interface ClassStaticBlockDeclaration extends ClassElement, JSDocContainer { 1917 readonly kind: SyntaxKind.ClassStaticBlockDeclaration; 1918 readonly parent: ClassDeclaration | ClassExpression; 1919 readonly body: Block; 1920 1921 /* @internal */ endFlowNode?: FlowNode; 1922 /* @internal */ returnFlowNode?: FlowNode; 1923 1924 // The following properties are used only to report grammar errors 1925 /* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; 1926 /* @internal */ readonly modifiers?: NodeArray<Modifier> | undefined; 1927 } 1928 1929 export interface TypeNode extends Node { 1930 _typeNodeBrand: any; 1931 } 1932 1933 /* @internal */ 1934 export interface TypeNode extends Node { 1935 readonly kind: TypeNodeSyntaxKind; 1936 } 1937 1938 export interface KeywordTypeNode<TKind extends KeywordTypeSyntaxKind = KeywordTypeSyntaxKind> extends KeywordToken<TKind>, TypeNode { 1939 readonly kind: TKind; 1940 } 1941 1942 export interface ImportTypeAssertionContainer extends Node { 1943 readonly kind: SyntaxKind.ImportTypeAssertionContainer; 1944 readonly parent: ImportTypeNode; 1945 readonly assertClause: AssertClause; 1946 readonly multiLine?: boolean; 1947 } 1948 1949 export interface ImportTypeNode extends NodeWithTypeArguments { 1950 readonly kind: SyntaxKind.ImportType; 1951 readonly isTypeOf: boolean; 1952 readonly argument: TypeNode; 1953 readonly assertions?: ImportTypeAssertionContainer; 1954 readonly qualifier?: EntityName; 1955 } 1956 1957 /* @internal */ 1958 export type LiteralImportTypeNode = ImportTypeNode & { readonly argument: LiteralTypeNode & { readonly literal: StringLiteral } }; 1959 1960 export interface ThisTypeNode extends TypeNode { 1961 readonly kind: SyntaxKind.ThisType; 1962 } 1963 1964 export type FunctionOrConstructorTypeNode = FunctionTypeNode | ConstructorTypeNode; 1965 1966 export interface FunctionOrConstructorTypeNodeBase extends TypeNode, SignatureDeclarationBase { 1967 readonly kind: SyntaxKind.FunctionType | SyntaxKind.ConstructorType; 1968 readonly type: TypeNode; 1969 } 1970 1971 export interface FunctionTypeNode extends FunctionOrConstructorTypeNodeBase { 1972 readonly kind: SyntaxKind.FunctionType; 1973 1974 // The following properties are used only to report grammar errors 1975 /* @internal */ readonly modifiers?: NodeArray<Modifier> | undefined; 1976 } 1977 1978 export interface ConstructorTypeNode extends FunctionOrConstructorTypeNodeBase { 1979 readonly kind: SyntaxKind.ConstructorType; 1980 readonly modifiers?: NodeArray<Modifier>; 1981 } 1982 1983 export interface NodeWithTypeArguments extends TypeNode { 1984 readonly typeArguments?: NodeArray<TypeNode>; 1985 } 1986 1987 export type TypeReferenceType = TypeReferenceNode | ExpressionWithTypeArguments; 1988 1989 export interface TypeReferenceNode extends NodeWithTypeArguments { 1990 readonly kind: SyntaxKind.TypeReference; 1991 readonly typeName: EntityName; 1992 } 1993 1994 export interface TypePredicateNode extends TypeNode { 1995 readonly kind: SyntaxKind.TypePredicate; 1996 readonly parent: SignatureDeclaration | JSDocTypeExpression; 1997 readonly assertsModifier?: AssertsKeyword; 1998 readonly parameterName: Identifier | ThisTypeNode; 1999 readonly type?: TypeNode; 2000 } 2001 2002 export interface TypeQueryNode extends NodeWithTypeArguments { 2003 readonly kind: SyntaxKind.TypeQuery; 2004 readonly exprName: EntityName; 2005 } 2006 2007 // A TypeLiteral is the declaration node for an anonymous symbol. 2008 export interface TypeLiteralNode extends TypeNode, Declaration { 2009 readonly kind: SyntaxKind.TypeLiteral; 2010 readonly members: NodeArray<TypeElement>; 2011 } 2012 2013 export interface ArrayTypeNode extends TypeNode { 2014 readonly kind: SyntaxKind.ArrayType; 2015 readonly elementType: TypeNode; 2016 } 2017 2018 export interface TupleTypeNode extends TypeNode { 2019 readonly kind: SyntaxKind.TupleType; 2020 readonly elements: NodeArray<TypeNode | NamedTupleMember>; 2021 } 2022 2023 export interface NamedTupleMember extends TypeNode, JSDocContainer, Declaration { 2024 readonly kind: SyntaxKind.NamedTupleMember; 2025 readonly dotDotDotToken?: Token<SyntaxKind.DotDotDotToken>; 2026 readonly name: Identifier; 2027 readonly questionToken?: Token<SyntaxKind.QuestionToken>; 2028 readonly type: TypeNode; 2029 } 2030 2031 export interface OptionalTypeNode extends TypeNode { 2032 readonly kind: SyntaxKind.OptionalType; 2033 readonly type: TypeNode; 2034 } 2035 2036 export interface RestTypeNode extends TypeNode { 2037 readonly kind: SyntaxKind.RestType; 2038 readonly type: TypeNode; 2039 } 2040 2041 export type UnionOrIntersectionTypeNode = UnionTypeNode | IntersectionTypeNode; 2042 2043 export interface UnionTypeNode extends TypeNode { 2044 readonly kind: SyntaxKind.UnionType; 2045 readonly types: NodeArray<TypeNode>; 2046 } 2047 2048 export interface IntersectionTypeNode extends TypeNode { 2049 readonly kind: SyntaxKind.IntersectionType; 2050 readonly types: NodeArray<TypeNode>; 2051 } 2052 2053 export interface ConditionalTypeNode extends TypeNode { 2054 readonly kind: SyntaxKind.ConditionalType; 2055 readonly checkType: TypeNode; 2056 readonly extendsType: TypeNode; 2057 readonly trueType: TypeNode; 2058 readonly falseType: TypeNode; 2059 } 2060 2061 export interface InferTypeNode extends TypeNode { 2062 readonly kind: SyntaxKind.InferType; 2063 readonly typeParameter: TypeParameterDeclaration; 2064 } 2065 2066 export interface ParenthesizedTypeNode extends TypeNode { 2067 readonly kind: SyntaxKind.ParenthesizedType; 2068 readonly type: TypeNode; 2069 } 2070 2071 export interface TypeOperatorNode extends TypeNode { 2072 readonly kind: SyntaxKind.TypeOperator; 2073 readonly operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword; 2074 readonly type: TypeNode; 2075 } 2076 2077 /* @internal */ 2078 export interface UniqueTypeOperatorNode extends TypeOperatorNode { 2079 readonly operator: SyntaxKind.UniqueKeyword; 2080 } 2081 2082 export interface IndexedAccessTypeNode extends TypeNode { 2083 readonly kind: SyntaxKind.IndexedAccessType; 2084 readonly objectType: TypeNode; 2085 readonly indexType: TypeNode; 2086 } 2087 2088 export interface MappedTypeNode extends TypeNode, Declaration { 2089 readonly kind: SyntaxKind.MappedType; 2090 readonly readonlyToken?: ReadonlyKeyword | PlusToken | MinusToken; 2091 readonly typeParameter: TypeParameterDeclaration; 2092 readonly nameType?: TypeNode; 2093 readonly questionToken?: QuestionToken | PlusToken | MinusToken; 2094 readonly type?: TypeNode; 2095 /** Used only to produce grammar errors */ 2096 readonly members?: NodeArray<TypeElement>; 2097 } 2098 2099 export interface LiteralTypeNode extends TypeNode { 2100 readonly kind: SyntaxKind.LiteralType; 2101 readonly literal: NullLiteral | BooleanLiteral | LiteralExpression | PrefixUnaryExpression; 2102 } 2103 2104 export interface StringLiteral extends LiteralExpression, Declaration { 2105 readonly kind: SyntaxKind.StringLiteral; 2106 /* @internal */ readonly textSourceNode?: Identifier | StringLiteralLike | NumericLiteral | PrivateIdentifier; // Allows a StringLiteral to get its text from another node (used by transforms). 2107 /** Note: this is only set when synthesizing a node, not during parsing. */ 2108 /* @internal */ readonly singleQuote?: boolean; 2109 } 2110 2111 export type StringLiteralLike = StringLiteral | NoSubstitutionTemplateLiteral; 2112 export type PropertyNameLiteral = Identifier | StringLiteralLike | NumericLiteral; 2113 2114 export interface TemplateLiteralTypeNode extends TypeNode { 2115 kind: SyntaxKind.TemplateLiteralType, 2116 readonly head: TemplateHead; 2117 readonly templateSpans: NodeArray<TemplateLiteralTypeSpan>; 2118 } 2119 2120 export interface TemplateLiteralTypeSpan extends TypeNode { 2121 readonly kind: SyntaxKind.TemplateLiteralTypeSpan, 2122 readonly parent: TemplateLiteralTypeNode; 2123 readonly type: TypeNode; 2124 readonly literal: TemplateMiddle | TemplateTail; 2125 } 2126 2127 // Note: 'brands' in our syntax nodes serve to give us a small amount of nominal typing. 2128 // Consider 'Expression'. Without the brand, 'Expression' is actually no different 2129 // (structurally) than 'Node'. Because of this you can pass any Node to a function that 2130 // takes an Expression without any error. By using the 'brands' we ensure that the type 2131 // checker actually thinks you have something of the right type. Note: the brands are 2132 // never actually given values. At runtime they have zero cost. 2133 2134 export interface Expression extends Node { 2135 _expressionBrand: any; 2136 } 2137 2138 export interface OmittedExpression extends Expression { 2139 readonly kind: SyntaxKind.OmittedExpression; 2140 } 2141 2142 // Represents an expression that is elided as part of a transformation to emit comments on a 2143 // not-emitted node. The 'expression' property of a PartiallyEmittedExpression should be emitted. 2144 export interface PartiallyEmittedExpression extends LeftHandSideExpression { 2145 readonly kind: SyntaxKind.PartiallyEmittedExpression; 2146 readonly expression: Expression; 2147 } 2148 2149 export interface UnaryExpression extends Expression { 2150 _unaryExpressionBrand: any; 2151 } 2152 2153 /** Deprecated, please use UpdateExpression */ 2154 export type IncrementExpression = UpdateExpression; 2155 export interface UpdateExpression extends UnaryExpression { 2156 _updateExpressionBrand: any; 2157 } 2158 2159 // see: https://tc39.github.io/ecma262/#prod-UpdateExpression 2160 // see: https://tc39.github.io/ecma262/#prod-UnaryExpression 2161 export type PrefixUnaryOperator 2162 = SyntaxKind.PlusPlusToken 2163 | SyntaxKind.MinusMinusToken 2164 | SyntaxKind.PlusToken 2165 | SyntaxKind.MinusToken 2166 | SyntaxKind.TildeToken 2167 | SyntaxKind.ExclamationToken; 2168 2169 export interface PrefixUnaryExpression extends UpdateExpression { 2170 readonly kind: SyntaxKind.PrefixUnaryExpression; 2171 readonly operator: PrefixUnaryOperator; 2172 readonly operand: UnaryExpression; 2173 } 2174 2175 // see: https://tc39.github.io/ecma262/#prod-UpdateExpression 2176 export type PostfixUnaryOperator 2177 = SyntaxKind.PlusPlusToken 2178 | SyntaxKind.MinusMinusToken 2179 ; 2180 2181 export interface PostfixUnaryExpression extends UpdateExpression { 2182 readonly kind: SyntaxKind.PostfixUnaryExpression; 2183 readonly operand: LeftHandSideExpression; 2184 readonly operator: PostfixUnaryOperator; 2185 } 2186 2187 export interface LeftHandSideExpression extends UpdateExpression { 2188 _leftHandSideExpressionBrand: any; 2189 } 2190 2191 export interface MemberExpression extends LeftHandSideExpression { 2192 _memberExpressionBrand: any; 2193 } 2194 2195 export interface PrimaryExpression extends MemberExpression { 2196 _primaryExpressionBrand: any; 2197 } 2198 2199 export interface NullLiteral extends PrimaryExpression { 2200 readonly kind: SyntaxKind.NullKeyword; 2201 } 2202 2203 export interface TrueLiteral extends PrimaryExpression { 2204 readonly kind: SyntaxKind.TrueKeyword; 2205 } 2206 2207 export interface FalseLiteral extends PrimaryExpression { 2208 readonly kind: SyntaxKind.FalseKeyword; 2209 } 2210 2211 export type BooleanLiteral = TrueLiteral | FalseLiteral; 2212 2213 export interface ThisExpression extends PrimaryExpression { 2214 readonly kind: SyntaxKind.ThisKeyword; 2215 } 2216 2217 export interface SuperExpression extends PrimaryExpression { 2218 readonly kind: SyntaxKind.SuperKeyword; 2219 } 2220 2221 export interface ImportExpression extends PrimaryExpression { 2222 readonly kind: SyntaxKind.ImportKeyword; 2223 } 2224 2225 export interface DeleteExpression extends UnaryExpression { 2226 readonly kind: SyntaxKind.DeleteExpression; 2227 readonly expression: UnaryExpression; 2228 } 2229 2230 export interface TypeOfExpression extends UnaryExpression { 2231 readonly kind: SyntaxKind.TypeOfExpression; 2232 readonly expression: UnaryExpression; 2233 } 2234 2235 export interface VoidExpression extends UnaryExpression { 2236 readonly kind: SyntaxKind.VoidExpression; 2237 readonly expression: UnaryExpression; 2238 } 2239 2240 export interface AwaitExpression extends UnaryExpression { 2241 readonly kind: SyntaxKind.AwaitExpression; 2242 readonly expression: UnaryExpression; 2243 } 2244 2245 export interface YieldExpression extends Expression { 2246 readonly kind: SyntaxKind.YieldExpression; 2247 readonly asteriskToken?: AsteriskToken; 2248 readonly expression?: Expression; 2249 } 2250 2251 export interface SyntheticExpression extends Expression { 2252 readonly kind: SyntaxKind.SyntheticExpression; 2253 readonly isSpread: boolean; 2254 readonly type: Type; 2255 readonly tupleNameSource?: ParameterDeclaration | NamedTupleMember; 2256 } 2257 2258 // see: https://tc39.github.io/ecma262/#prod-ExponentiationExpression 2259 export type ExponentiationOperator = 2260 | SyntaxKind.AsteriskAsteriskToken 2261 ; 2262 2263 // see: https://tc39.github.io/ecma262/#prod-MultiplicativeOperator 2264 export type MultiplicativeOperator = 2265 | SyntaxKind.AsteriskToken 2266 | SyntaxKind.SlashToken 2267 | SyntaxKind.PercentToken 2268 ; 2269 2270 // see: https://tc39.github.io/ecma262/#prod-MultiplicativeExpression 2271 export type MultiplicativeOperatorOrHigher = 2272 | ExponentiationOperator 2273 | MultiplicativeOperator 2274 ; 2275 2276 // see: https://tc39.github.io/ecma262/#prod-AdditiveExpression 2277 export type AdditiveOperator = 2278 | SyntaxKind.PlusToken 2279 | SyntaxKind.MinusToken 2280 ; 2281 2282 // see: https://tc39.github.io/ecma262/#prod-AdditiveExpression 2283 export type AdditiveOperatorOrHigher = 2284 | MultiplicativeOperatorOrHigher 2285 | AdditiveOperator 2286 ; 2287 2288 // see: https://tc39.github.io/ecma262/#prod-ShiftExpression 2289 export type ShiftOperator = 2290 | SyntaxKind.LessThanLessThanToken 2291 | SyntaxKind.GreaterThanGreaterThanToken 2292 | SyntaxKind.GreaterThanGreaterThanGreaterThanToken 2293 ; 2294 2295 // see: https://tc39.github.io/ecma262/#prod-ShiftExpression 2296 export type ShiftOperatorOrHigher = 2297 | AdditiveOperatorOrHigher 2298 | ShiftOperator 2299 ; 2300 2301 // see: https://tc39.github.io/ecma262/#prod-RelationalExpression 2302 export type RelationalOperator = 2303 | SyntaxKind.LessThanToken 2304 | SyntaxKind.LessThanEqualsToken 2305 | SyntaxKind.GreaterThanToken 2306 | SyntaxKind.GreaterThanEqualsToken 2307 | SyntaxKind.InstanceOfKeyword 2308 | SyntaxKind.InKeyword 2309 ; 2310 2311 // see: https://tc39.github.io/ecma262/#prod-RelationalExpression 2312 export type RelationalOperatorOrHigher = 2313 | ShiftOperatorOrHigher 2314 | RelationalOperator 2315 ; 2316 2317 // see: https://tc39.github.io/ecma262/#prod-EqualityExpression 2318 export type EqualityOperator = 2319 | SyntaxKind.EqualsEqualsToken 2320 | SyntaxKind.EqualsEqualsEqualsToken 2321 | SyntaxKind.ExclamationEqualsEqualsToken 2322 | SyntaxKind.ExclamationEqualsToken 2323 ; 2324 2325 // see: https://tc39.github.io/ecma262/#prod-EqualityExpression 2326 export type EqualityOperatorOrHigher = 2327 | RelationalOperatorOrHigher 2328 | EqualityOperator; 2329 2330 // see: https://tc39.github.io/ecma262/#prod-BitwiseANDExpression 2331 // see: https://tc39.github.io/ecma262/#prod-BitwiseXORExpression 2332 // see: https://tc39.github.io/ecma262/#prod-BitwiseORExpression 2333 export type BitwiseOperator = 2334 | SyntaxKind.AmpersandToken 2335 | SyntaxKind.BarToken 2336 | SyntaxKind.CaretToken 2337 ; 2338 2339 // see: https://tc39.github.io/ecma262/#prod-BitwiseANDExpression 2340 // see: https://tc39.github.io/ecma262/#prod-BitwiseXORExpression 2341 // see: https://tc39.github.io/ecma262/#prod-BitwiseORExpression 2342 export type BitwiseOperatorOrHigher = 2343 | EqualityOperatorOrHigher 2344 | BitwiseOperator 2345 ; 2346 2347 // see: https://tc39.github.io/ecma262/#prod-LogicalANDExpression 2348 // see: https://tc39.github.io/ecma262/#prod-LogicalORExpression 2349 export type LogicalOperator = 2350 | SyntaxKind.AmpersandAmpersandToken 2351 | SyntaxKind.BarBarToken 2352 ; 2353 2354 // see: https://tc39.github.io/ecma262/#prod-LogicalANDExpression 2355 // see: https://tc39.github.io/ecma262/#prod-LogicalORExpression 2356 export type LogicalOperatorOrHigher = 2357 | BitwiseOperatorOrHigher 2358 | LogicalOperator 2359 ; 2360 2361 // see: https://tc39.github.io/ecma262/#prod-AssignmentOperator 2362 export type CompoundAssignmentOperator = 2363 | SyntaxKind.PlusEqualsToken 2364 | SyntaxKind.MinusEqualsToken 2365 | SyntaxKind.AsteriskAsteriskEqualsToken 2366 | SyntaxKind.AsteriskEqualsToken 2367 | SyntaxKind.SlashEqualsToken 2368 | SyntaxKind.PercentEqualsToken 2369 | SyntaxKind.AmpersandEqualsToken 2370 | SyntaxKind.BarEqualsToken 2371 | SyntaxKind.CaretEqualsToken 2372 | SyntaxKind.LessThanLessThanEqualsToken 2373 | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken 2374 | SyntaxKind.GreaterThanGreaterThanEqualsToken 2375 | SyntaxKind.BarBarEqualsToken 2376 | SyntaxKind.AmpersandAmpersandEqualsToken 2377 | SyntaxKind.QuestionQuestionEqualsToken 2378 ; 2379 2380 // see: https://tc39.github.io/ecma262/#prod-AssignmentExpression 2381 export type AssignmentOperator = 2382 | SyntaxKind.EqualsToken 2383 | CompoundAssignmentOperator 2384 ; 2385 2386 // see: https://tc39.github.io/ecma262/#prod-AssignmentExpression 2387 export type AssignmentOperatorOrHigher = 2388 | SyntaxKind.QuestionQuestionToken 2389 | LogicalOperatorOrHigher 2390 | AssignmentOperator 2391 ; 2392 2393 // see: https://tc39.github.io/ecma262/#prod-Expression 2394 export type BinaryOperator = 2395 | AssignmentOperatorOrHigher 2396 | SyntaxKind.CommaToken 2397 ; 2398 2399 export type LogicalOrCoalescingAssignmentOperator 2400 = SyntaxKind.AmpersandAmpersandEqualsToken 2401 | SyntaxKind.BarBarEqualsToken 2402 | SyntaxKind.QuestionQuestionEqualsToken 2403 ; 2404 2405 export type BinaryOperatorToken = Token<BinaryOperator>; 2406 2407 export interface BinaryExpression extends Expression, Declaration { 2408 readonly kind: SyntaxKind.BinaryExpression; 2409 readonly left: Expression; 2410 readonly operatorToken: BinaryOperatorToken; 2411 readonly right: Expression; 2412 } 2413 2414 export type AssignmentOperatorToken = Token<AssignmentOperator>; 2415 2416 export interface AssignmentExpression<TOperator extends AssignmentOperatorToken> extends BinaryExpression { 2417 readonly left: LeftHandSideExpression; 2418 readonly operatorToken: TOperator; 2419 } 2420 2421 export interface ObjectDestructuringAssignment extends AssignmentExpression<EqualsToken> { 2422 readonly left: ObjectLiteralExpression; 2423 } 2424 2425 export interface ArrayDestructuringAssignment extends AssignmentExpression<EqualsToken> { 2426 readonly left: ArrayLiteralExpression; 2427 } 2428 2429 export type DestructuringAssignment = 2430 | ObjectDestructuringAssignment 2431 | ArrayDestructuringAssignment 2432 ; 2433 2434 export type BindingOrAssignmentElement = 2435 | VariableDeclaration 2436 | ParameterDeclaration 2437 | ObjectBindingOrAssignmentElement 2438 | ArrayBindingOrAssignmentElement 2439 ; 2440 2441 export type ObjectBindingOrAssignmentElement = 2442 | BindingElement 2443 | PropertyAssignment // AssignmentProperty 2444 | ShorthandPropertyAssignment // AssignmentProperty 2445 | SpreadAssignment // AssignmentRestProperty 2446 ; 2447 2448 export type ArrayBindingOrAssignmentElement = 2449 | BindingElement 2450 | OmittedExpression // Elision 2451 | SpreadElement // AssignmentRestElement 2452 | ArrayLiteralExpression // ArrayAssignmentPattern 2453 | ObjectLiteralExpression // ObjectAssignmentPattern 2454 | AssignmentExpression<EqualsToken> // AssignmentElement 2455 | Identifier // DestructuringAssignmentTarget 2456 | PropertyAccessExpression // DestructuringAssignmentTarget 2457 | ElementAccessExpression // DestructuringAssignmentTarget 2458 ; 2459 2460 export type BindingOrAssignmentElementRestIndicator = 2461 | DotDotDotToken // from BindingElement 2462 | SpreadElement // AssignmentRestElement 2463 | SpreadAssignment // AssignmentRestProperty 2464 ; 2465 2466 export type BindingOrAssignmentElementTarget = 2467 | BindingOrAssignmentPattern 2468 | Identifier 2469 | PropertyAccessExpression 2470 | ElementAccessExpression 2471 | OmittedExpression; 2472 2473 export type ObjectBindingOrAssignmentPattern = 2474 | ObjectBindingPattern 2475 | ObjectLiteralExpression // ObjectAssignmentPattern 2476 ; 2477 2478 export type ArrayBindingOrAssignmentPattern = 2479 | ArrayBindingPattern 2480 | ArrayLiteralExpression // ArrayAssignmentPattern 2481 ; 2482 2483 export type AssignmentPattern = ObjectLiteralExpression | ArrayLiteralExpression; 2484 2485 export type BindingOrAssignmentPattern = ObjectBindingOrAssignmentPattern | ArrayBindingOrAssignmentPattern; 2486 2487 export interface ConditionalExpression extends Expression { 2488 readonly kind: SyntaxKind.ConditionalExpression; 2489 readonly condition: Expression; 2490 readonly questionToken: QuestionToken; 2491 readonly whenTrue: Expression; 2492 readonly colonToken: ColonToken; 2493 readonly whenFalse: Expression; 2494 } 2495 2496 export type FunctionBody = Block; 2497 export type ConciseBody = FunctionBody | Expression; 2498 2499 export interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclarationBase, JSDocContainer { 2500 readonly kind: SyntaxKind.FunctionExpression; 2501 readonly modifiers?: NodeArray<Modifier>; 2502 readonly name?: Identifier; 2503 readonly body: FunctionBody; // Required, whereas the member inherited from FunctionDeclaration is optional 2504 } 2505 2506 export interface EtsComponentExpression extends PrimaryExpression, Declaration { 2507 readonly kind: SyntaxKind.EtsComponentExpression; 2508 readonly expression: LeftHandSideExpression; 2509 readonly typeArguments?: NodeArray<TypeNode>; 2510 readonly arguments: NodeArray<Expression>; 2511 readonly body?: Block; 2512 } 2513 2514 export interface ArrowFunction extends Expression, FunctionLikeDeclarationBase, JSDocContainer { 2515 readonly kind: SyntaxKind.ArrowFunction; 2516 readonly modifiers?: NodeArray<Modifier>; 2517 readonly equalsGreaterThanToken: EqualsGreaterThanToken; 2518 readonly body: ConciseBody; 2519 readonly name: never; 2520 } 2521 2522 // The text property of a LiteralExpression stores the interpreted value of the literal in text form. For a StringLiteral, 2523 // or any literal of a template, this means quotes have been removed and escapes have been converted to actual characters. 2524 // For a NumericLiteral, the stored value is the toString() representation of the number. For example 1, 1.00, and 1e0 are all stored as just "1". 2525 export interface LiteralLikeNode extends Node { 2526 text: string; 2527 isUnterminated?: boolean; 2528 hasExtendedUnicodeEscape?: boolean; 2529 } 2530 2531 export interface TemplateLiteralLikeNode extends LiteralLikeNode { 2532 rawText?: string; 2533 /* @internal */ 2534 templateFlags?: TokenFlags; 2535 } 2536 2537 // The text property of a LiteralExpression stores the interpreted value of the literal in text form. For a StringLiteral, 2538 // or any literal of a template, this means quotes have been removed and escapes have been converted to actual characters. 2539 // For a NumericLiteral, the stored value is the toString() representation of the number. For example 1, 1.00, and 1e0 are all stored as just "1". 2540 export interface LiteralExpression extends LiteralLikeNode, PrimaryExpression { 2541 _literalExpressionBrand: any; 2542 } 2543 2544 export interface RegularExpressionLiteral extends LiteralExpression { 2545 readonly kind: SyntaxKind.RegularExpressionLiteral; 2546 } 2547 2548 export interface NoSubstitutionTemplateLiteral extends LiteralExpression, TemplateLiteralLikeNode, Declaration { 2549 readonly kind: SyntaxKind.NoSubstitutionTemplateLiteral; 2550 /* @internal */ 2551 templateFlags?: TokenFlags; 2552 } 2553 2554 export const enum TokenFlags { 2555 None = 0, 2556 /* @internal */ 2557 PrecedingLineBreak = 1 << 0, 2558 /* @internal */ 2559 PrecedingJSDocComment = 1 << 1, 2560 /* @internal */ 2561 Unterminated = 1 << 2, 2562 /* @internal */ 2563 ExtendedUnicodeEscape = 1 << 3, 2564 Scientific = 1 << 4, // e.g. `10e2` 2565 Octal = 1 << 5, // e.g. `0777` 2566 HexSpecifier = 1 << 6, // e.g. `0x00000000` 2567 BinarySpecifier = 1 << 7, // e.g. `0b0110010000000000` 2568 OctalSpecifier = 1 << 8, // e.g. `0o777` 2569 /* @internal */ 2570 ContainsSeparator = 1 << 9, // e.g. `0b1100_0101` 2571 /* @internal */ 2572 UnicodeEscape = 1 << 10, 2573 /* @internal */ 2574 ContainsInvalidEscape = 1 << 11, // e.g. `\uhello` 2575 /* @internal */ 2576 BinaryOrOctalSpecifier = BinarySpecifier | OctalSpecifier, 2577 /* @internal */ 2578 NumericLiteralFlags = Scientific | Octal | HexSpecifier | BinaryOrOctalSpecifier | ContainsSeparator, 2579 /* @internal */ 2580 TemplateLiteralLikeFlags = ContainsInvalidEscape, 2581 } 2582 2583 export interface NumericLiteral extends LiteralExpression, Declaration { 2584 readonly kind: SyntaxKind.NumericLiteral; 2585 /* @internal */ 2586 readonly numericLiteralFlags: TokenFlags; 2587 } 2588 2589 export interface BigIntLiteral extends LiteralExpression { 2590 readonly kind: SyntaxKind.BigIntLiteral; 2591 } 2592 2593 export type LiteralToken = 2594 | NumericLiteral 2595 | BigIntLiteral 2596 | StringLiteral 2597 | JsxText 2598 | RegularExpressionLiteral 2599 | NoSubstitutionTemplateLiteral 2600 ; 2601 2602 export interface TemplateHead extends TemplateLiteralLikeNode { 2603 readonly kind: SyntaxKind.TemplateHead; 2604 readonly parent: TemplateExpression | TemplateLiteralTypeNode; 2605 /* @internal */ 2606 templateFlags?: TokenFlags; 2607 } 2608 2609 export interface TemplateMiddle extends TemplateLiteralLikeNode { 2610 readonly kind: SyntaxKind.TemplateMiddle; 2611 readonly parent: TemplateSpan | TemplateLiteralTypeSpan; 2612 /* @internal */ 2613 templateFlags?: TokenFlags; 2614 } 2615 2616 export interface TemplateTail extends TemplateLiteralLikeNode { 2617 readonly kind: SyntaxKind.TemplateTail; 2618 readonly parent: TemplateSpan | TemplateLiteralTypeSpan; 2619 /* @internal */ 2620 templateFlags?: TokenFlags; 2621 } 2622 2623 export type PseudoLiteralToken = 2624 | TemplateHead 2625 | TemplateMiddle 2626 | TemplateTail 2627 ; 2628 2629 export type TemplateLiteralToken = 2630 | NoSubstitutionTemplateLiteral 2631 | PseudoLiteralToken 2632 ; 2633 2634 export interface TemplateExpression extends PrimaryExpression { 2635 readonly kind: SyntaxKind.TemplateExpression; 2636 readonly head: TemplateHead; 2637 readonly templateSpans: NodeArray<TemplateSpan>; 2638 } 2639 2640 export type TemplateLiteral = 2641 | TemplateExpression 2642 | NoSubstitutionTemplateLiteral 2643 ; 2644 2645 // Each of these corresponds to a substitution expression and a template literal, in that order. 2646 // The template literal must have kind TemplateMiddleLiteral or TemplateTailLiteral. 2647 export interface TemplateSpan extends Node { 2648 readonly kind: SyntaxKind.TemplateSpan; 2649 readonly parent: TemplateExpression; 2650 readonly expression: Expression; 2651 readonly literal: TemplateMiddle | TemplateTail; 2652 } 2653 2654 export interface ParenthesizedExpression extends PrimaryExpression, JSDocContainer { 2655 readonly kind: SyntaxKind.ParenthesizedExpression; 2656 readonly expression: Expression; 2657 } 2658 2659 /* @internal */ 2660 export interface JSDocTypeAssertion extends ParenthesizedExpression { 2661 readonly _jsDocTypeAssertionBrand: never; 2662 } 2663 2664 export interface ArrayLiteralExpression extends PrimaryExpression { 2665 readonly kind: SyntaxKind.ArrayLiteralExpression; 2666 readonly elements: NodeArray<Expression>; 2667 /* @internal */ 2668 multiLine?: boolean; 2669 } 2670 2671 export interface SpreadElement extends Expression { 2672 readonly kind: SyntaxKind.SpreadElement; 2673 readonly parent: ArrayLiteralExpression | CallExpression | NewExpression; 2674 readonly expression: Expression; 2675 } 2676 2677 /** 2678 * This interface is a base interface for ObjectLiteralExpression and JSXAttributes to extend from. JSXAttributes is similar to 2679 * ObjectLiteralExpression in that it contains array of properties; however, JSXAttributes' properties can only be 2680 * JSXAttribute or JSXSpreadAttribute. ObjectLiteralExpression, on the other hand, can only have properties of type 2681 * ObjectLiteralElement (e.g. PropertyAssignment, ShorthandPropertyAssignment etc.) 2682 */ 2683 export interface ObjectLiteralExpressionBase<T extends ObjectLiteralElement> extends PrimaryExpression, Declaration { 2684 readonly properties: NodeArray<T>; 2685 } 2686 2687 // An ObjectLiteralExpression is the declaration node for an anonymous symbol. 2688 export interface ObjectLiteralExpression extends ObjectLiteralExpressionBase<ObjectLiteralElementLike> { 2689 readonly kind: SyntaxKind.ObjectLiteralExpression; 2690 /* @internal */ 2691 multiLine?: boolean; 2692 } 2693 2694 export type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression; 2695 export type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression; 2696 export type AccessExpression = PropertyAccessExpression | ElementAccessExpression; 2697 2698 export interface PropertyAccessExpression extends MemberExpression, NamedDeclaration { 2699 readonly kind: SyntaxKind.PropertyAccessExpression; 2700 readonly expression: LeftHandSideExpression; 2701 readonly questionDotToken?: QuestionDotToken; 2702 readonly name: MemberName; 2703 } 2704 2705 /*@internal*/ 2706 export interface PrivateIdentifierPropertyAccessExpression extends PropertyAccessExpression { 2707 readonly name: PrivateIdentifier; 2708 } 2709 2710 export interface PropertyAccessChain extends PropertyAccessExpression { 2711 _optionalChainBrand: any; 2712 readonly name: MemberName; 2713 } 2714 2715 /* @internal */ 2716 export interface PropertyAccessChainRoot extends PropertyAccessChain { 2717 readonly questionDotToken: QuestionDotToken; 2718 } 2719 2720 export interface SuperPropertyAccessExpression extends PropertyAccessExpression { 2721 readonly expression: SuperExpression; 2722 } 2723 2724 /** Brand for a PropertyAccessExpression which, like a QualifiedName, consists of a sequence of identifiers separated by dots. */ 2725 export interface PropertyAccessEntityNameExpression extends PropertyAccessExpression { 2726 _propertyAccessExpressionLikeQualifiedNameBrand?: any; 2727 readonly expression: EntityNameExpression; 2728 readonly name: Identifier; 2729 } 2730 2731 export interface ElementAccessExpression extends MemberExpression { 2732 readonly kind: SyntaxKind.ElementAccessExpression; 2733 readonly expression: LeftHandSideExpression; 2734 readonly questionDotToken?: QuestionDotToken; 2735 readonly argumentExpression: Expression; 2736 } 2737 2738 export interface ElementAccessChain extends ElementAccessExpression { 2739 _optionalChainBrand: any; 2740 } 2741 2742 /* @internal */ 2743 export interface ElementAccessChainRoot extends ElementAccessChain { 2744 readonly questionDotToken: QuestionDotToken; 2745 } 2746 2747 export interface SuperElementAccessExpression extends ElementAccessExpression { 2748 readonly expression: SuperExpression; 2749 } 2750 2751 // see: https://tc39.github.io/ecma262/#prod-SuperProperty 2752 export type SuperProperty = SuperPropertyAccessExpression | SuperElementAccessExpression; 2753 2754 export interface CallExpression extends LeftHandSideExpression, Declaration { 2755 readonly kind: SyntaxKind.CallExpression; 2756 readonly expression: LeftHandSideExpression; 2757 readonly questionDotToken?: QuestionDotToken; 2758 readonly typeArguments?: NodeArray<TypeNode>; 2759 readonly arguments: NodeArray<Expression>; 2760 } 2761 2762 export interface CallChain extends CallExpression { 2763 _optionalChainBrand: any; 2764 } 2765 2766 /* @internal */ 2767 export interface CallChainRoot extends CallChain { 2768 readonly questionDotToken: QuestionDotToken; 2769 } 2770 2771 export type OptionalChain = 2772 | PropertyAccessChain 2773 | ElementAccessChain 2774 | CallChain 2775 | NonNullChain 2776 ; 2777 2778 /* @internal */ 2779 export type OptionalChainRoot = 2780 | PropertyAccessChainRoot 2781 | ElementAccessChainRoot 2782 | CallChainRoot 2783 ; 2784 2785 /** @internal */ 2786 export type BindableObjectDefinePropertyCall = CallExpression & { 2787 readonly arguments: readonly [BindableStaticNameExpression, StringLiteralLike | NumericLiteral, ObjectLiteralExpression] & Readonly<TextRange>; 2788 }; 2789 2790 /** @internal */ 2791 export type BindableStaticNameExpression = 2792 | EntityNameExpression 2793 | BindableStaticElementAccessExpression 2794 ; 2795 2796 /** @internal */ 2797 export type LiteralLikeElementAccessExpression = ElementAccessExpression & Declaration & { 2798 readonly argumentExpression: StringLiteralLike | NumericLiteral; 2799 }; 2800 2801 /** @internal */ 2802 export type BindableStaticElementAccessExpression = LiteralLikeElementAccessExpression & { 2803 readonly expression: BindableStaticNameExpression; 2804 }; 2805 2806 /** @internal */ 2807 export type BindableElementAccessExpression = ElementAccessExpression & { 2808 readonly expression: BindableStaticNameExpression; 2809 }; 2810 2811 /** @internal */ 2812 export type BindableStaticAccessExpression = 2813 | PropertyAccessEntityNameExpression 2814 | BindableStaticElementAccessExpression 2815 ; 2816 2817 /** @internal */ 2818 export type BindableAccessExpression = 2819 | PropertyAccessEntityNameExpression 2820 | BindableElementAccessExpression 2821 ; 2822 2823 /** @internal */ 2824 export interface BindableStaticPropertyAssignmentExpression extends BinaryExpression { 2825 readonly left: BindableStaticAccessExpression; 2826 } 2827 2828 /** @internal */ 2829 export interface BindablePropertyAssignmentExpression extends BinaryExpression { 2830 readonly left: BindableAccessExpression; 2831 } 2832 2833 // see: https://tc39.github.io/ecma262/#prod-SuperCall 2834 export interface SuperCall extends CallExpression { 2835 readonly expression: SuperExpression; 2836 } 2837 2838 export interface ImportCall extends CallExpression { 2839 readonly expression: ImportExpression; 2840 } 2841 2842 export interface ExpressionWithTypeArguments extends MemberExpression, NodeWithTypeArguments { 2843 readonly kind: SyntaxKind.ExpressionWithTypeArguments; 2844 readonly expression: LeftHandSideExpression; 2845 } 2846 2847 export interface NewExpression extends PrimaryExpression, Declaration { 2848 readonly kind: SyntaxKind.NewExpression; 2849 readonly expression: LeftHandSideExpression; 2850 readonly typeArguments?: NodeArray<TypeNode>; 2851 readonly arguments?: NodeArray<Expression>; 2852 } 2853 2854 export interface TaggedTemplateExpression extends MemberExpression { 2855 readonly kind: SyntaxKind.TaggedTemplateExpression; 2856 readonly tag: LeftHandSideExpression; 2857 readonly typeArguments?: NodeArray<TypeNode>; 2858 readonly template: TemplateLiteral; 2859 /*@internal*/ questionDotToken?: QuestionDotToken; // NOTE: Invalid syntax, only used to report a grammar error. 2860 } 2861 2862 export type CallLikeExpression = 2863 | CallExpression 2864 | NewExpression 2865 | TaggedTemplateExpression 2866 | Decorator 2867 | JsxOpeningLikeElement 2868 | EtsComponentExpression 2869 ; 2870 2871 export interface AsExpression extends Expression { 2872 readonly kind: SyntaxKind.AsExpression; 2873 readonly expression: Expression; 2874 readonly type: TypeNode; 2875 } 2876 2877 export interface TypeAssertion extends UnaryExpression { 2878 readonly kind: SyntaxKind.TypeAssertionExpression; 2879 readonly type: TypeNode; 2880 readonly expression: UnaryExpression; 2881 } 2882 2883 export interface SatisfiesExpression extends Expression { 2884 readonly kind: SyntaxKind.SatisfiesExpression; 2885 readonly expression: Expression; 2886 readonly type: TypeNode; 2887 } 2888 2889 export type AssertionExpression = 2890 | TypeAssertion 2891 | AsExpression 2892 ; 2893 2894 export interface NonNullExpression extends LeftHandSideExpression { 2895 readonly kind: SyntaxKind.NonNullExpression; 2896 readonly expression: Expression; 2897 } 2898 2899 export interface NonNullChain extends NonNullExpression { 2900 _optionalChainBrand: any; 2901 } 2902 2903 // NOTE: MetaProperty is really a MemberExpression, but we consider it a PrimaryExpression 2904 // for the same reasons we treat NewExpression as a PrimaryExpression. 2905 export interface MetaProperty extends PrimaryExpression { 2906 readonly kind: SyntaxKind.MetaProperty; 2907 readonly keywordToken: SyntaxKind.NewKeyword | SyntaxKind.ImportKeyword; 2908 readonly name: Identifier; 2909 } 2910 2911 /* @internal */ 2912 export interface ImportMetaProperty extends MetaProperty { 2913 readonly keywordToken: SyntaxKind.ImportKeyword; 2914 readonly name: Identifier & { readonly escapedText: __String & "meta" }; 2915 } 2916 2917 /// A JSX expression of the form <TagName attrs>...</TagName> 2918 export interface JsxElement extends PrimaryExpression { 2919 readonly kind: SyntaxKind.JsxElement; 2920 readonly openingElement: JsxOpeningElement; 2921 readonly children: NodeArray<JsxChild>; 2922 readonly closingElement: JsxClosingElement; 2923 } 2924 2925 /// Either the opening tag in a <Tag>...</Tag> pair or the lone <Tag /> in a self-closing form 2926 export type JsxOpeningLikeElement = 2927 | JsxSelfClosingElement 2928 | JsxOpeningElement 2929 ; 2930 2931 export type JsxAttributeLike = 2932 | JsxAttribute 2933 | JsxSpreadAttribute 2934 ; 2935 2936 export type JsxTagNameExpression = 2937 | Identifier 2938 | ThisExpression 2939 | JsxTagNamePropertyAccess 2940 ; 2941 2942 export interface JsxTagNamePropertyAccess extends PropertyAccessExpression { 2943 readonly expression: JsxTagNameExpression; 2944 } 2945 2946 export interface JsxAttributes extends ObjectLiteralExpressionBase<JsxAttributeLike> { 2947 readonly kind: SyntaxKind.JsxAttributes; 2948 readonly parent: JsxOpeningLikeElement; 2949 } 2950 2951 /// The opening element of a <Tag>...</Tag> JsxElement 2952 export interface JsxOpeningElement extends Expression { 2953 readonly kind: SyntaxKind.JsxOpeningElement; 2954 readonly parent: JsxElement; 2955 readonly tagName: JsxTagNameExpression; 2956 readonly typeArguments?: NodeArray<TypeNode>; 2957 readonly attributes: JsxAttributes; 2958 } 2959 2960 /// A JSX expression of the form <TagName attrs /> 2961 export interface JsxSelfClosingElement extends PrimaryExpression { 2962 readonly kind: SyntaxKind.JsxSelfClosingElement; 2963 readonly tagName: JsxTagNameExpression; 2964 readonly typeArguments?: NodeArray<TypeNode>; 2965 readonly attributes: JsxAttributes; 2966 } 2967 2968 /// A JSX expression of the form <>...</> 2969 export interface JsxFragment extends PrimaryExpression { 2970 readonly kind: SyntaxKind.JsxFragment; 2971 readonly openingFragment: JsxOpeningFragment; 2972 readonly children: NodeArray<JsxChild>; 2973 readonly closingFragment: JsxClosingFragment; 2974 } 2975 2976 /// The opening element of a <>...</> JsxFragment 2977 export interface JsxOpeningFragment extends Expression { 2978 readonly kind: SyntaxKind.JsxOpeningFragment; 2979 readonly parent: JsxFragment; 2980 } 2981 2982 /// The closing element of a <>...</> JsxFragment 2983 export interface JsxClosingFragment extends Expression { 2984 readonly kind: SyntaxKind.JsxClosingFragment; 2985 readonly parent: JsxFragment; 2986 } 2987 2988 export interface JsxAttribute extends ObjectLiteralElement { 2989 readonly kind: SyntaxKind.JsxAttribute; 2990 readonly parent: JsxAttributes; 2991 readonly name: Identifier; 2992 /// JSX attribute initializers are optional; <X y /> is sugar for <X y={true} /> 2993 readonly initializer?: JsxAttributeValue; 2994 } 2995 2996 export type JsxAttributeValue = 2997 | StringLiteral 2998 | JsxExpression 2999 | JsxElement 3000 | JsxSelfClosingElement 3001 | JsxFragment; 3002 3003 export interface JsxSpreadAttribute extends ObjectLiteralElement { 3004 readonly kind: SyntaxKind.JsxSpreadAttribute; 3005 readonly parent: JsxAttributes; 3006 readonly expression: Expression; 3007 } 3008 3009 export interface JsxClosingElement extends Node { 3010 readonly kind: SyntaxKind.JsxClosingElement; 3011 readonly parent: JsxElement; 3012 readonly tagName: JsxTagNameExpression; 3013 } 3014 3015 export interface JsxExpression extends Expression { 3016 readonly kind: SyntaxKind.JsxExpression; 3017 readonly parent: JsxElement | JsxFragment | JsxAttributeLike; 3018 readonly dotDotDotToken?: Token<SyntaxKind.DotDotDotToken>; 3019 readonly expression?: Expression; 3020 } 3021 3022 export interface JsxText extends LiteralLikeNode { 3023 readonly kind: SyntaxKind.JsxText; 3024 readonly parent: JsxElement | JsxFragment; 3025 readonly containsOnlyTriviaWhiteSpaces: boolean; 3026 } 3027 3028 export type JsxChild = 3029 | JsxText 3030 | JsxExpression 3031 | JsxElement 3032 | JsxSelfClosingElement 3033 | JsxFragment 3034 ; 3035 3036 export interface Statement extends Node, JSDocContainer { 3037 _statementBrand: any; 3038 } 3039 3040 // Represents a statement that is elided as part of a transformation to emit comments on a 3041 // not-emitted node. 3042 export interface NotEmittedStatement extends Statement { 3043 readonly kind: SyntaxKind.NotEmittedStatement; 3044 } 3045 3046 /** 3047 * Marks the end of transformed declaration to properly emit exports. 3048 */ 3049 /* @internal */ 3050 export interface EndOfDeclarationMarker extends Statement { 3051 readonly kind: SyntaxKind.EndOfDeclarationMarker; 3052 } 3053 3054 /** 3055 * A list of comma-separated expressions. This node is only created by transformations. 3056 */ 3057 export interface CommaListExpression extends Expression { 3058 readonly kind: SyntaxKind.CommaListExpression; 3059 readonly elements: NodeArray<Expression>; 3060 } 3061 3062 /** 3063 * Marks the beginning of a merged transformed declaration. 3064 */ 3065 /* @internal */ 3066 export interface MergeDeclarationMarker extends Statement { 3067 readonly kind: SyntaxKind.MergeDeclarationMarker; 3068 } 3069 3070 /* @internal */ 3071 export interface SyntheticReferenceExpression extends LeftHandSideExpression { 3072 readonly kind: SyntaxKind.SyntheticReferenceExpression; 3073 readonly expression: Expression; 3074 readonly thisArg: Expression; 3075 } 3076 3077 export interface EmptyStatement extends Statement { 3078 readonly kind: SyntaxKind.EmptyStatement; 3079 } 3080 3081 export interface DebuggerStatement extends Statement { 3082 readonly kind: SyntaxKind.DebuggerStatement; 3083 } 3084 3085 export interface MissingDeclaration extends DeclarationStatement { 3086 readonly kind: SyntaxKind.MissingDeclaration; 3087 readonly name?: Identifier; 3088 3089 // The following properties are used only to report grammar errors 3090 /*@internal*/ illegalDecorators?: NodeArray<Decorator> | undefined; 3091 /*@internal*/ modifiers?: NodeArray<Modifier> | undefined; 3092 } 3093 3094 export type BlockLike = 3095 | SourceFile 3096 | Block 3097 | ModuleBlock 3098 | CaseOrDefaultClause 3099 ; 3100 3101 export interface Block extends Statement { 3102 readonly kind: SyntaxKind.Block; 3103 readonly statements: NodeArray<Statement>; 3104 /*@internal*/ multiLine?: boolean; 3105 } 3106 3107 export interface VariableStatement extends Statement { 3108 readonly kind: SyntaxKind.VariableStatement; 3109 readonly modifiers?: NodeArray<Modifier>; 3110 readonly declarationList: VariableDeclarationList; 3111 3112 // The following properties are used only to report grammar errors 3113 /* @internal*/ illegalDecorators?: NodeArray<Decorator> | undefined; 3114 } 3115 3116 export interface ExpressionStatement extends Statement { 3117 readonly kind: SyntaxKind.ExpressionStatement; 3118 readonly expression: Expression; 3119 } 3120 3121 /* @internal */ 3122 export interface PrologueDirective extends ExpressionStatement { 3123 readonly expression: StringLiteral; 3124 } 3125 3126 export interface IfStatement extends Statement { 3127 readonly kind: SyntaxKind.IfStatement; 3128 readonly expression: Expression; 3129 readonly thenStatement: Statement; 3130 readonly elseStatement?: Statement; 3131 } 3132 3133 export interface IterationStatement extends Statement { 3134 readonly statement: Statement; 3135 } 3136 3137 export interface DoStatement extends IterationStatement { 3138 readonly kind: SyntaxKind.DoStatement; 3139 readonly expression: Expression; 3140 } 3141 3142 export interface WhileStatement extends IterationStatement { 3143 readonly kind: SyntaxKind.WhileStatement; 3144 readonly expression: Expression; 3145 } 3146 3147 export type ForInitializer = 3148 | VariableDeclarationList 3149 | Expression 3150 ; 3151 3152 export interface ForStatement extends IterationStatement { 3153 readonly kind: SyntaxKind.ForStatement; 3154 readonly initializer?: ForInitializer; 3155 readonly condition?: Expression; 3156 readonly incrementor?: Expression; 3157 } 3158 3159 export type ForInOrOfStatement = 3160 | ForInStatement 3161 | ForOfStatement 3162 ; 3163 3164 export interface ForInStatement extends IterationStatement { 3165 readonly kind: SyntaxKind.ForInStatement; 3166 readonly initializer: ForInitializer; 3167 readonly expression: Expression; 3168 } 3169 3170 export interface ForOfStatement extends IterationStatement { 3171 readonly kind: SyntaxKind.ForOfStatement; 3172 readonly awaitModifier?: AwaitKeyword; 3173 readonly initializer: ForInitializer; 3174 readonly expression: Expression; 3175 } 3176 3177 export interface BreakStatement extends Statement { 3178 readonly kind: SyntaxKind.BreakStatement; 3179 readonly label?: Identifier; 3180 } 3181 3182 export interface ContinueStatement extends Statement { 3183 readonly kind: SyntaxKind.ContinueStatement; 3184 readonly label?: Identifier; 3185 } 3186 3187 export type BreakOrContinueStatement = 3188 | BreakStatement 3189 | ContinueStatement 3190 ; 3191 3192 export interface ReturnStatement extends Statement { 3193 readonly kind: SyntaxKind.ReturnStatement; 3194 readonly expression?: Expression; 3195 } 3196 3197 export interface WithStatement extends Statement { 3198 readonly kind: SyntaxKind.WithStatement; 3199 readonly expression: Expression; 3200 readonly statement: Statement; 3201 } 3202 3203 export interface SwitchStatement extends Statement { 3204 readonly kind: SyntaxKind.SwitchStatement; 3205 readonly expression: Expression; 3206 readonly caseBlock: CaseBlock; 3207 possiblyExhaustive?: boolean; // initialized by binding 3208 } 3209 3210 export interface CaseBlock extends Node { 3211 readonly kind: SyntaxKind.CaseBlock; 3212 readonly parent: SwitchStatement; 3213 readonly clauses: NodeArray<CaseOrDefaultClause>; 3214 } 3215 3216 export interface CaseClause extends Node, JSDocContainer { 3217 readonly kind: SyntaxKind.CaseClause; 3218 readonly parent: CaseBlock; 3219 readonly expression: Expression; 3220 readonly statements: NodeArray<Statement>; 3221 /* @internal */ fallthroughFlowNode?: FlowNode; 3222 } 3223 3224 export interface DefaultClause extends Node { 3225 readonly kind: SyntaxKind.DefaultClause; 3226 readonly parent: CaseBlock; 3227 readonly statements: NodeArray<Statement>; 3228 /* @internal */ fallthroughFlowNode?: FlowNode; 3229 } 3230 3231 export type CaseOrDefaultClause = 3232 | CaseClause 3233 | DefaultClause 3234 ; 3235 3236 export interface LabeledStatement extends Statement { 3237 readonly kind: SyntaxKind.LabeledStatement; 3238 readonly label: Identifier; 3239 readonly statement: Statement; 3240 } 3241 3242 export interface ThrowStatement extends Statement { 3243 readonly kind: SyntaxKind.ThrowStatement; 3244 readonly expression: Expression; 3245 } 3246 3247 export interface TryStatement extends Statement { 3248 readonly kind: SyntaxKind.TryStatement; 3249 readonly tryBlock: Block; 3250 readonly catchClause?: CatchClause; 3251 readonly finallyBlock?: Block; 3252 } 3253 3254 export interface CatchClause extends Node { 3255 readonly kind: SyntaxKind.CatchClause; 3256 readonly parent: TryStatement; 3257 readonly variableDeclaration?: VariableDeclaration; 3258 readonly block: Block; 3259 } 3260 3261 export type ObjectTypeDeclaration = 3262 | ClassLikeDeclaration 3263 | InterfaceDeclaration 3264 | TypeLiteralNode 3265 ; 3266 3267 export type DeclarationWithTypeParameters = 3268 | DeclarationWithTypeParameterChildren 3269 | JSDocTypedefTag 3270 | JSDocCallbackTag 3271 | JSDocSignature 3272 ; 3273 3274 export type DeclarationWithTypeParameterChildren = 3275 | SignatureDeclaration 3276 | ClassLikeDeclaration 3277 | InterfaceDeclaration 3278 | TypeAliasDeclaration 3279 | JSDocTemplateTag 3280 ; 3281 3282 export interface ClassLikeDeclarationBase extends NamedDeclaration, JSDocContainer { 3283 readonly kind: SyntaxKind.ClassDeclaration | SyntaxKind.ClassExpression | SyntaxKind.StructDeclaration; 3284 readonly name?: Identifier; 3285 readonly typeParameters?: NodeArray<TypeParameterDeclaration>; 3286 readonly heritageClauses?: NodeArray<HeritageClause>; 3287 readonly members: NodeArray<ClassElement>; 3288 } 3289 3290 export interface ClassDeclaration extends ClassLikeDeclarationBase, DeclarationStatement { 3291 readonly kind: SyntaxKind.ClassDeclaration; 3292 readonly modifiers?: NodeArray<ModifierLike>; 3293 /** May be undefined in `export default class { ... }`. */ 3294 readonly name?: Identifier; 3295 } 3296 3297 export interface StructDeclaration extends ClassLikeDeclarationBase, DeclarationStatement { 3298 readonly kind: SyntaxKind.StructDeclaration; 3299 readonly modifiers?: NodeArray<ModifierLike>; 3300 /** May be undefined in `export default class { ... }`. */ 3301 readonly name?: Identifier; 3302 } 3303 3304 export interface ClassExpression extends ClassLikeDeclarationBase, PrimaryExpression { 3305 readonly kind: SyntaxKind.ClassExpression; 3306 readonly modifiers?: NodeArray<ModifierLike>; 3307 } 3308 3309 export type ClassLikeDeclaration = 3310 | ClassDeclaration 3311 | ClassExpression 3312 | StructDeclaration 3313 ; 3314 3315 export interface ClassElement extends NamedDeclaration { 3316 _classElementBrand: any; 3317 readonly name?: PropertyName; 3318 } 3319 3320 export interface TypeElement extends NamedDeclaration { 3321 _typeElementBrand: any; 3322 readonly name?: PropertyName; 3323 readonly questionToken?: QuestionToken | undefined; 3324 } 3325 3326 export interface InterfaceDeclaration extends DeclarationStatement, JSDocContainer { 3327 readonly kind: SyntaxKind.InterfaceDeclaration; 3328 readonly modifiers?: NodeArray<Modifier>; 3329 readonly name: Identifier; 3330 readonly typeParameters?: NodeArray<TypeParameterDeclaration>; 3331 readonly heritageClauses?: NodeArray<HeritageClause>; 3332 readonly members: NodeArray<TypeElement>; 3333 3334 // The following properties are used only to report grammar errors 3335 /* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; 3336 } 3337 3338 export interface HeritageClause extends Node { 3339 readonly kind: SyntaxKind.HeritageClause; 3340 readonly parent: InterfaceDeclaration | ClassLikeDeclaration; 3341 readonly token: SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword; 3342 readonly types: NodeArray<ExpressionWithTypeArguments>; 3343 } 3344 3345 export interface TypeAliasDeclaration extends DeclarationStatement, JSDocContainer { 3346 readonly kind: SyntaxKind.TypeAliasDeclaration; 3347 readonly modifiers?: NodeArray<Modifier>; 3348 readonly name: Identifier; 3349 readonly typeParameters?: NodeArray<TypeParameterDeclaration>; 3350 readonly type: TypeNode; 3351 3352 // The following properties are used only to report grammar errors 3353 /* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; 3354 } 3355 3356 export interface EnumMember extends NamedDeclaration, JSDocContainer { 3357 readonly kind: SyntaxKind.EnumMember; 3358 readonly parent: EnumDeclaration; 3359 // This does include ComputedPropertyName, but the parser will give an error 3360 // if it parses a ComputedPropertyName in an EnumMember 3361 readonly name: PropertyName; 3362 readonly initializer?: Expression; 3363 } 3364 3365 export interface EnumDeclaration extends DeclarationStatement, JSDocContainer { 3366 readonly kind: SyntaxKind.EnumDeclaration; 3367 readonly modifiers?: NodeArray<Modifier>; 3368 readonly name: Identifier; 3369 readonly members: NodeArray<EnumMember>; 3370 3371 // The following properties are used only to report grammar errors 3372 /* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; 3373 } 3374 3375 export type ModuleName = 3376 | Identifier 3377 | StringLiteral 3378 ; 3379 3380 export type ModuleBody = 3381 | NamespaceBody 3382 | JSDocNamespaceBody 3383 ; 3384 3385 /* @internal */ 3386 export interface AmbientModuleDeclaration extends ModuleDeclaration { 3387 readonly body?: ModuleBlock; 3388 } 3389 3390 export interface ModuleDeclaration extends DeclarationStatement, JSDocContainer { 3391 readonly kind: SyntaxKind.ModuleDeclaration; 3392 readonly parent: ModuleBody | SourceFile; 3393 readonly modifiers?: NodeArray<Modifier>; 3394 readonly name: ModuleName; 3395 readonly body?: ModuleBody | JSDocNamespaceDeclaration; 3396 3397 // The following properties are used only to report grammar errors 3398 /* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; 3399 } 3400 3401 export type NamespaceBody = 3402 | ModuleBlock 3403 | NamespaceDeclaration 3404 ; 3405 3406 export interface NamespaceDeclaration extends ModuleDeclaration { 3407 readonly name: Identifier; 3408 readonly body: NamespaceBody; 3409 } 3410 3411 export type JSDocNamespaceBody = 3412 | Identifier 3413 | JSDocNamespaceDeclaration 3414 ; 3415 3416 export interface JSDocNamespaceDeclaration extends ModuleDeclaration { 3417 readonly name: Identifier; 3418 readonly body?: JSDocNamespaceBody; 3419 } 3420 3421 export interface ModuleBlock extends Node, Statement { 3422 readonly kind: SyntaxKind.ModuleBlock; 3423 readonly parent: ModuleDeclaration; 3424 readonly statements: NodeArray<Statement>; 3425 } 3426 3427 export type ModuleReference = 3428 | EntityName 3429 | ExternalModuleReference 3430 ; 3431 3432 /** 3433 * One of: 3434 * - import x = require("mod"); 3435 * - import x = M.x; 3436 */ 3437 export interface ImportEqualsDeclaration extends DeclarationStatement, JSDocContainer { 3438 readonly kind: SyntaxKind.ImportEqualsDeclaration; 3439 readonly parent: SourceFile | ModuleBlock; 3440 readonly modifiers?: NodeArray<Modifier>; 3441 readonly name: Identifier; 3442 readonly isTypeOnly: boolean; 3443 3444 // 'EntityName' for an internal module reference, 'ExternalModuleReference' for an external 3445 // module reference. 3446 readonly moduleReference: ModuleReference; 3447 3448 // The following properties are used only to report grammar errors 3449 /* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; 3450 } 3451 3452 export interface ExternalModuleReference extends Node { 3453 readonly kind: SyntaxKind.ExternalModuleReference; 3454 readonly parent: ImportEqualsDeclaration; 3455 readonly expression: Expression; 3456 } 3457 3458 // In case of: 3459 // import "mod" => importClause = undefined, moduleSpecifier = "mod" 3460 // In rest of the cases, module specifier is string literal corresponding to module 3461 // ImportClause information is shown at its declaration below. 3462 export interface ImportDeclaration extends Statement { 3463 readonly kind: SyntaxKind.ImportDeclaration; 3464 readonly parent: SourceFile | ModuleBlock; 3465 readonly modifiers?: NodeArray<Modifier>; 3466 readonly importClause?: ImportClause; 3467 /** If this is not a StringLiteral it will be a grammar error. */ 3468 readonly moduleSpecifier: Expression; 3469 readonly assertClause?: AssertClause; 3470 3471 // The following properties are used only to report grammar errors 3472 /* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; 3473 } 3474 3475 export type NamedImportBindings = 3476 | NamespaceImport 3477 | NamedImports 3478 ; 3479 3480 export type NamedExportBindings = 3481 | NamespaceExport 3482 | NamedExports 3483 ; 3484 3485 // In case of: 3486 // import d from "mod" => name = d, namedBinding = undefined 3487 // import * as ns from "mod" => name = undefined, namedBinding: NamespaceImport = { name: ns } 3488 // import d, * as ns from "mod" => name = d, namedBinding: NamespaceImport = { name: ns } 3489 // import { a, b as x } from "mod" => name = undefined, namedBinding: NamedImports = { elements: [{ name: a }, { name: x, propertyName: b}]} 3490 // import d, { a, b as x } from "mod" => name = d, namedBinding: NamedImports = { elements: [{ name: a }, { name: x, propertyName: b}]} 3491 export interface ImportClause extends NamedDeclaration { 3492 readonly kind: SyntaxKind.ImportClause; 3493 readonly parent: ImportDeclaration; 3494 readonly isTypeOnly: boolean; 3495 readonly name?: Identifier; // Default binding 3496 readonly namedBindings?: NamedImportBindings; 3497 } 3498 3499 export type AssertionKey = Identifier | StringLiteral; 3500 3501 export interface AssertEntry extends Node { 3502 readonly kind: SyntaxKind.AssertEntry; 3503 readonly parent: AssertClause; 3504 readonly name: AssertionKey; 3505 readonly value: Expression; 3506 } 3507 3508 export interface AssertClause extends Node { 3509 readonly kind: SyntaxKind.AssertClause; 3510 readonly parent: ImportDeclaration | ExportDeclaration 3511 readonly elements: NodeArray<AssertEntry>; 3512 readonly multiLine?: boolean; 3513 } 3514 3515 export interface NamespaceImport extends NamedDeclaration { 3516 readonly kind: SyntaxKind.NamespaceImport; 3517 readonly parent: ImportClause; 3518 readonly name: Identifier; 3519 } 3520 3521 export interface NamespaceExport extends NamedDeclaration { 3522 readonly kind: SyntaxKind.NamespaceExport; 3523 readonly parent: ExportDeclaration; 3524 readonly name: Identifier 3525 } 3526 3527 export interface NamespaceExportDeclaration extends DeclarationStatement, JSDocContainer { 3528 readonly kind: SyntaxKind.NamespaceExportDeclaration; 3529 readonly name: Identifier; 3530 3531 // The following properties are used only to report grammar errors 3532 /* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; 3533 /* @internal */ readonly modifiers?: NodeArray<Modifier> | undefined; 3534 } 3535 3536 export interface ExportDeclaration extends DeclarationStatement, JSDocContainer { 3537 readonly kind: SyntaxKind.ExportDeclaration; 3538 readonly parent: SourceFile | ModuleBlock; 3539 readonly modifiers?: NodeArray<Modifier>; 3540 readonly isTypeOnly: boolean; 3541 /** Will not be assigned in the case of `export * from "foo";` */ 3542 readonly exportClause?: NamedExportBindings; 3543 /** If this is not a StringLiteral it will be a grammar error. */ 3544 readonly moduleSpecifier?: Expression; 3545 readonly assertClause?: AssertClause; 3546 3547 // The following properties are used only to report grammar errors 3548 /* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; 3549 } 3550 3551 export interface NamedImports extends Node { 3552 readonly kind: SyntaxKind.NamedImports; 3553 readonly parent: ImportClause; 3554 readonly elements: NodeArray<ImportSpecifier>; 3555 } 3556 3557 export interface NamedExports extends Node { 3558 readonly kind: SyntaxKind.NamedExports; 3559 readonly parent: ExportDeclaration; 3560 readonly elements: NodeArray<ExportSpecifier>; 3561 } 3562 3563 export type NamedImportsOrExports = NamedImports | NamedExports; 3564 3565 export interface ImportSpecifier extends NamedDeclaration { 3566 readonly kind: SyntaxKind.ImportSpecifier; 3567 readonly parent: NamedImports; 3568 readonly propertyName?: Identifier; // Name preceding "as" keyword (or undefined when "as" is absent) 3569 readonly name: Identifier; // Declared name 3570 readonly isTypeOnly: boolean; 3571 } 3572 3573 export interface ExportSpecifier extends NamedDeclaration, JSDocContainer { 3574 readonly kind: SyntaxKind.ExportSpecifier; 3575 readonly parent: NamedExports; 3576 readonly isTypeOnly: boolean; 3577 readonly propertyName?: Identifier; // Name preceding "as" keyword (or undefined when "as" is absent) 3578 readonly name: Identifier; // Declared name 3579 } 3580 3581 export type ImportOrExportSpecifier = 3582 | ImportSpecifier 3583 | ExportSpecifier 3584 ; 3585 3586 export type TypeOnlyCompatibleAliasDeclaration = 3587 | ImportClause 3588 | ImportEqualsDeclaration 3589 | NamespaceImport 3590 | ImportOrExportSpecifier 3591 ; 3592 3593 export type TypeOnlyAliasDeclaration = 3594 | ImportClause & { readonly isTypeOnly: true, readonly name: Identifier } 3595 | ImportEqualsDeclaration & { readonly isTypeOnly: true } 3596 | NamespaceImport & { readonly parent: ImportClause & { readonly isTypeOnly: true } } 3597 | ImportSpecifier & ({ readonly isTypeOnly: true } | { readonly parent: NamedImports & { readonly parent: ImportClause & { readonly isTypeOnly: true } } }) 3598 | ExportSpecifier & ({ readonly isTypeOnly: true } | { readonly parent: NamedExports & { readonly parent: ExportDeclaration & { readonly isTypeOnly: true } } }) 3599 ; 3600 3601 /** 3602 * This is either an `export =` or an `export default` declaration. 3603 * Unless `isExportEquals` is set, this node was parsed as an `export default`. 3604 */ 3605 export interface ExportAssignment extends DeclarationStatement, JSDocContainer { 3606 readonly kind: SyntaxKind.ExportAssignment; 3607 readonly parent: SourceFile; 3608 readonly modifiers?: NodeArray<Modifier>; 3609 readonly isExportEquals?: boolean; 3610 readonly expression: Expression; 3611 3612 // The following properties are used only to report grammar errors 3613 /* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; 3614 } 3615 3616 export interface FileReference extends TextRange { 3617 fileName: string; 3618 resolutionMode?: SourceFile["impliedNodeFormat"]; 3619 } 3620 3621 export interface CheckJsDirective extends TextRange { 3622 enabled: boolean; 3623 } 3624 3625 export type CommentKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia; 3626 3627 export interface CommentRange extends TextRange { 3628 hasTrailingNewLine?: boolean; 3629 kind: CommentKind; 3630 } 3631 3632 export interface SynthesizedComment extends CommentRange { 3633 text: string; 3634 pos: -1; 3635 end: -1; 3636 hasLeadingNewline?: boolean; 3637 } 3638 3639 // represents a top level: { type } expression in a JSDoc comment. 3640 export interface JSDocTypeExpression extends TypeNode { 3641 readonly kind: SyntaxKind.JSDocTypeExpression; 3642 readonly type: TypeNode; 3643 } 3644 3645 export interface JSDocNameReference extends Node { 3646 readonly kind: SyntaxKind.JSDocNameReference; 3647 readonly name: EntityName | JSDocMemberName; 3648 } 3649 3650 /** Class#method reference in JSDoc */ 3651 export interface JSDocMemberName extends Node { 3652 readonly kind: SyntaxKind.JSDocMemberName; 3653 readonly left: EntityName | JSDocMemberName; 3654 readonly right: Identifier; 3655 } 3656 3657 export interface JSDocType extends TypeNode { 3658 _jsDocTypeBrand: any; 3659 } 3660 3661 export interface JSDocAllType extends JSDocType { 3662 readonly kind: SyntaxKind.JSDocAllType; 3663 } 3664 3665 export interface JSDocUnknownType extends JSDocType { 3666 readonly kind: SyntaxKind.JSDocUnknownType; 3667 } 3668 3669 export interface JSDocNonNullableType extends JSDocType { 3670 readonly kind: SyntaxKind.JSDocNonNullableType; 3671 readonly type: TypeNode; 3672 readonly postfix: boolean; 3673 } 3674 3675 export interface JSDocNullableType extends JSDocType { 3676 readonly kind: SyntaxKind.JSDocNullableType; 3677 readonly type: TypeNode; 3678 readonly postfix: boolean; 3679 } 3680 3681 export interface JSDocOptionalType extends JSDocType { 3682 readonly kind: SyntaxKind.JSDocOptionalType; 3683 readonly type: TypeNode; 3684 } 3685 3686 export interface JSDocFunctionType extends JSDocType, SignatureDeclarationBase { 3687 readonly kind: SyntaxKind.JSDocFunctionType; 3688 } 3689 3690 export interface JSDocVariadicType extends JSDocType { 3691 readonly kind: SyntaxKind.JSDocVariadicType; 3692 readonly type: TypeNode; 3693 } 3694 3695 export interface JSDocNamepathType extends JSDocType { 3696 readonly kind: SyntaxKind.JSDocNamepathType; 3697 readonly type: TypeNode; 3698 } 3699 3700 export type JSDocTypeReferencingNode = 3701 | JSDocVariadicType 3702 | JSDocOptionalType 3703 | JSDocNullableType 3704 | JSDocNonNullableType 3705 ; 3706 3707 export interface JSDoc extends Node { 3708 readonly kind: SyntaxKind.JSDoc; 3709 readonly parent: HasJSDoc; 3710 readonly tags?: NodeArray<JSDocTag>; 3711 readonly comment?: string | NodeArray<JSDocComment>; 3712 } 3713 3714 export interface JSDocTag extends Node { 3715 readonly parent: JSDoc | JSDocTypeLiteral; 3716 readonly tagName: Identifier; 3717 readonly comment?: string | NodeArray<JSDocComment>; 3718 } 3719 3720 export interface JSDocLink extends Node { 3721 readonly kind: SyntaxKind.JSDocLink; 3722 readonly name?: EntityName | JSDocMemberName; 3723 text: string; 3724 } 3725 3726 export interface JSDocLinkCode extends Node { 3727 readonly kind: SyntaxKind.JSDocLinkCode; 3728 readonly name?: EntityName | JSDocMemberName; 3729 text: string; 3730 } 3731 3732 export interface JSDocLinkPlain extends Node { 3733 readonly kind: SyntaxKind.JSDocLinkPlain; 3734 readonly name?: EntityName | JSDocMemberName; 3735 text: string; 3736 } 3737 3738 export type JSDocComment = JSDocText | JSDocLink | JSDocLinkCode | JSDocLinkPlain; 3739 3740 export interface JSDocText extends Node { 3741 readonly kind: SyntaxKind.JSDocText; 3742 text: string; 3743 } 3744 3745 export interface JSDocUnknownTag extends JSDocTag { 3746 readonly kind: SyntaxKind.JSDocTag; 3747 } 3748 3749 /** 3750 * Note that `@extends` is a synonym of `@augments`. 3751 * Both tags are represented by this interface. 3752 */ 3753 export interface JSDocAugmentsTag extends JSDocTag { 3754 readonly kind: SyntaxKind.JSDocAugmentsTag; 3755 readonly class: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression }; 3756 } 3757 3758 export interface JSDocImplementsTag extends JSDocTag { 3759 readonly kind: SyntaxKind.JSDocImplementsTag; 3760 readonly class: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression }; 3761 } 3762 3763 export interface JSDocAuthorTag extends JSDocTag { 3764 readonly kind: SyntaxKind.JSDocAuthorTag; 3765 } 3766 3767 export interface JSDocDeprecatedTag extends JSDocTag { 3768 kind: SyntaxKind.JSDocDeprecatedTag; 3769 } 3770 3771 export interface JSDocClassTag extends JSDocTag { 3772 readonly kind: SyntaxKind.JSDocClassTag; 3773 } 3774 3775 export interface JSDocPublicTag extends JSDocTag { 3776 readonly kind: SyntaxKind.JSDocPublicTag; 3777 } 3778 3779 export interface JSDocPrivateTag extends JSDocTag { 3780 readonly kind: SyntaxKind.JSDocPrivateTag; 3781 } 3782 3783 export interface JSDocProtectedTag extends JSDocTag { 3784 readonly kind: SyntaxKind.JSDocProtectedTag; 3785 } 3786 3787 export interface JSDocReadonlyTag extends JSDocTag { 3788 readonly kind: SyntaxKind.JSDocReadonlyTag; 3789 } 3790 3791 export interface JSDocOverrideTag extends JSDocTag { 3792 readonly kind: SyntaxKind.JSDocOverrideTag; 3793 } 3794 3795 export interface JSDocEnumTag extends JSDocTag, Declaration { 3796 readonly kind: SyntaxKind.JSDocEnumTag; 3797 readonly parent: JSDoc; 3798 readonly typeExpression: JSDocTypeExpression; 3799 } 3800 3801 export interface JSDocThisTag extends JSDocTag { 3802 readonly kind: SyntaxKind.JSDocThisTag; 3803 readonly typeExpression: JSDocTypeExpression; 3804 } 3805 3806 export interface JSDocTemplateTag extends JSDocTag { 3807 readonly kind: SyntaxKind.JSDocTemplateTag; 3808 readonly constraint: JSDocTypeExpression | undefined; 3809 readonly typeParameters: NodeArray<TypeParameterDeclaration>; 3810 } 3811 3812 export interface JSDocSeeTag extends JSDocTag { 3813 readonly kind: SyntaxKind.JSDocSeeTag; 3814 readonly name?: JSDocNameReference; 3815 } 3816 3817 export interface JSDocReturnTag extends JSDocTag { 3818 readonly kind: SyntaxKind.JSDocReturnTag; 3819 readonly typeExpression?: JSDocTypeExpression; 3820 } 3821 3822 export interface JSDocTypeTag extends JSDocTag { 3823 readonly kind: SyntaxKind.JSDocTypeTag; 3824 readonly typeExpression: JSDocTypeExpression; 3825 } 3826 3827 export interface JSDocTypedefTag extends JSDocTag, NamedDeclaration { 3828 readonly kind: SyntaxKind.JSDocTypedefTag; 3829 readonly parent: JSDoc; 3830 readonly fullName?: JSDocNamespaceDeclaration | Identifier; 3831 readonly name?: Identifier; 3832 readonly typeExpression?: JSDocTypeExpression | JSDocTypeLiteral; 3833 } 3834 3835 export interface JSDocCallbackTag extends JSDocTag, NamedDeclaration { 3836 readonly kind: SyntaxKind.JSDocCallbackTag; 3837 readonly parent: JSDoc; 3838 readonly fullName?: JSDocNamespaceDeclaration | Identifier; 3839 readonly name?: Identifier; 3840 readonly typeExpression: JSDocSignature; 3841 } 3842 3843 export interface JSDocSignature extends JSDocType, Declaration { 3844 readonly kind: SyntaxKind.JSDocSignature; 3845 readonly typeParameters?: readonly JSDocTemplateTag[]; 3846 readonly parameters: readonly JSDocParameterTag[]; 3847 readonly type: JSDocReturnTag | undefined; 3848 } 3849 3850 export interface JSDocPropertyLikeTag extends JSDocTag, Declaration { 3851 readonly parent: JSDoc; 3852 readonly name: EntityName; 3853 readonly typeExpression?: JSDocTypeExpression; 3854 /** Whether the property name came before the type -- non-standard for JSDoc, but Typescript-like */ 3855 readonly isNameFirst: boolean; 3856 readonly isBracketed: boolean; 3857 } 3858 3859 export interface JSDocPropertyTag extends JSDocPropertyLikeTag { 3860 readonly kind: SyntaxKind.JSDocPropertyTag; 3861 } 3862 3863 export interface JSDocParameterTag extends JSDocPropertyLikeTag { 3864 readonly kind: SyntaxKind.JSDocParameterTag; 3865 } 3866 3867 export interface JSDocTypeLiteral extends JSDocType { 3868 readonly kind: SyntaxKind.JSDocTypeLiteral; 3869 readonly jsDocPropertyTags?: readonly JSDocPropertyLikeTag[]; 3870 /** If true, then this type literal represents an *array* of its type. */ 3871 readonly isArrayType: boolean; 3872 } 3873 3874 // NOTE: Ensure this is up-to-date with src/debug/debug.ts 3875 export const enum FlowFlags { 3876 Unreachable = 1 << 0, // Unreachable code 3877 Start = 1 << 1, // Start of flow graph 3878 BranchLabel = 1 << 2, // Non-looping junction 3879 LoopLabel = 1 << 3, // Looping junction 3880 Assignment = 1 << 4, // Assignment 3881 TrueCondition = 1 << 5, // Condition known to be true 3882 FalseCondition = 1 << 6, // Condition known to be false 3883 SwitchClause = 1 << 7, // Switch statement clause 3884 ArrayMutation = 1 << 8, // Potential array mutation 3885 Call = 1 << 9, // Potential assertion call 3886 ReduceLabel = 1 << 10, // Temporarily reduce antecedents of label 3887 Referenced = 1 << 11, // Referenced as antecedent once 3888 Shared = 1 << 12, // Referenced as antecedent more than once 3889 3890 Label = BranchLabel | LoopLabel, 3891 Condition = TrueCondition | FalseCondition, 3892 } 3893 3894 export type FlowNode = 3895 | FlowStart 3896 | FlowLabel 3897 | FlowAssignment 3898 | FlowCondition 3899 | FlowSwitchClause 3900 | FlowArrayMutation 3901 | FlowCall 3902 | FlowReduceLabel; 3903 3904 export interface FlowNodeBase { 3905 flags: FlowFlags; 3906 id?: number; // Node id used by flow type cache in checker 3907 } 3908 3909 // FlowStart represents the start of a control flow. For a function expression or arrow 3910 // function, the node property references the function (which in turn has a flowNode 3911 // property for the containing control flow). 3912 export interface FlowStart extends FlowNodeBase { 3913 node?: FunctionExpression | ArrowFunction | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration; 3914 } 3915 3916 // FlowLabel represents a junction with multiple possible preceding control flows. 3917 export interface FlowLabel extends FlowNodeBase { 3918 antecedents: FlowNode[] | undefined; 3919 } 3920 3921 // FlowAssignment represents a node that assigns a value to a narrowable reference, 3922 // i.e. an identifier or a dotted name that starts with an identifier or 'this'. 3923 export interface FlowAssignment extends FlowNodeBase { 3924 node: Expression | VariableDeclaration | BindingElement; 3925 antecedent: FlowNode; 3926 } 3927 3928 export interface FlowCall extends FlowNodeBase { 3929 node: CallExpression; 3930 antecedent: FlowNode; 3931 } 3932 3933 // FlowCondition represents a condition that is known to be true or false at the 3934 // node's location in the control flow. 3935 export interface FlowCondition extends FlowNodeBase { 3936 node: Expression; 3937 antecedent: FlowNode; 3938 } 3939 3940 export interface FlowSwitchClause extends FlowNodeBase { 3941 switchStatement: SwitchStatement; 3942 clauseStart: number; // Start index of case/default clause range 3943 clauseEnd: number; // End index of case/default clause range 3944 antecedent: FlowNode; 3945 } 3946 3947 // FlowArrayMutation represents a node potentially mutates an array, i.e. an 3948 // operation of the form 'x.push(value)', 'x.unshift(value)' or 'x[n] = value'. 3949 export interface FlowArrayMutation extends FlowNodeBase { 3950 node: CallExpression | BinaryExpression; 3951 antecedent: FlowNode; 3952 } 3953 3954 export interface FlowReduceLabel extends FlowNodeBase { 3955 target: FlowLabel; 3956 antecedents: FlowNode[]; 3957 antecedent: FlowNode; 3958 } 3959 3960 export type FlowType = Type | IncompleteType; 3961 3962 // Incomplete types occur during control flow analysis of loops. An IncompleteType 3963 // is distinguished from a regular type by a flags value of zero. Incomplete type 3964 // objects are internal to the getFlowTypeOfReference function and never escape it. 3965 export interface IncompleteType { 3966 flags: TypeFlags; // No flags set 3967 type: Type; // The type marked incomplete 3968 } 3969 3970 export interface AmdDependency { 3971 path: string; 3972 name?: string; 3973 } 3974 3975 /** 3976 * Subset of properties from SourceFile that are used in multiple utility functions 3977 */ 3978 export interface SourceFileLike { 3979 readonly text: string; 3980 /* @internal */ 3981 lineMap?: readonly number[]; 3982 readonly fileName?: string; 3983 /* @internal */ 3984 getPositionOfLineAndCharacter?(line: number, character: number, allowEdits?: true): number; 3985 } 3986 3987 3988 /* @internal */ 3989 export interface RedirectInfo { 3990 /** Source file this redirects to. */ 3991 readonly redirectTarget: SourceFile; 3992 /** 3993 * Source file for the duplicate package. This will not be used by the Program, 3994 * but we need to keep this around so we can watch for changes in underlying. 3995 */ 3996 readonly unredirected: SourceFile; 3997 } 3998 3999 // Source files are declarations when they are external modules. 4000 export interface SourceFile extends Declaration { 4001 readonly kind: SyntaxKind.SourceFile; 4002 readonly statements: NodeArray<Statement>; 4003 readonly endOfFileToken: Token<SyntaxKind.EndOfFileToken>; 4004 fileName: string; 4005 /* @internal */ path: Path; 4006 text: string; 4007 /** Resolved path can be different from path property, 4008 * when file is included through project reference is mapped to its output instead of source 4009 * in that case resolvedPath = path to output file 4010 * path = input file's path 4011 */ 4012 /* @internal */ resolvedPath: Path; 4013 /** Original file name that can be different from fileName, 4014 * when file is included through project reference is mapped to its output instead of source 4015 * in that case originalFileName = name of input file 4016 * fileName = output file's name 4017 */ 4018 /* @internal */ originalFileName: string; 4019 4020 /** 4021 * If two source files are for the same version of the same package, one will redirect to the other. 4022 * (See `createRedirectSourceFile` in program.ts.) 4023 * The redirect will have this set. The redirected-to source file will be in `redirectTargetsMap`. 4024 */ 4025 /* @internal */ redirectInfo?: RedirectInfo; 4026 4027 amdDependencies: readonly AmdDependency[]; 4028 moduleName?: string; 4029 referencedFiles: readonly FileReference[]; 4030 typeReferenceDirectives: readonly FileReference[]; 4031 libReferenceDirectives: readonly FileReference[]; 4032 languageVariant: LanguageVariant; 4033 isDeclarationFile: boolean; 4034 4035 // this map is used by transpiler to supply alternative names for dependencies (i.e. in case of bundling) 4036 /* @internal */ 4037 renamedDependencies?: ReadonlyESMap<string, string>; 4038 4039 /** 4040 * lib.d.ts should have a reference comment like 4041 * 4042 * /// <reference no-default-lib="true"/> 4043 * 4044 * If any other file has this comment, it signals not to include lib.d.ts 4045 * because this containing file is intended to act as a default library. 4046 */ 4047 hasNoDefaultLib: boolean; 4048 4049 languageVersion: ScriptTarget; 4050 4051 /** 4052 * When `module` is `Node16` or `NodeNext`, this field controls whether the 4053 * source file in question is an ESNext-output-format file, or a CommonJS-output-format 4054 * module. This is derived by the module resolver as it looks up the file, since 4055 * it is derived from either the file extension of the module, or the containing 4056 * `package.json` context, and affects both checking and emit. 4057 * 4058 * It is _public_ so that (pre)transformers can set this field, 4059 * since it switches the builtin `node` module transform. Generally speaking, if unset, 4060 * the field is treated as though it is `ModuleKind.CommonJS`. 4061 * 4062 * Note that this field is only set by the module resolution process when 4063 * `moduleResolution` is `Node16` or `NodeNext`, which is implied by the `module` setting 4064 * of `Node16` or `NodeNext`, respectively, but may be overriden (eg, by a `moduleResolution` 4065 * of `node`). If so, this field will be unset and source files will be considered to be 4066 * CommonJS-output-format by the node module transformer and type checker, regardless of extension or context. 4067 */ 4068 impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS; 4069 /*@internal*/ packageJsonLocations?: readonly string[]; 4070 /*@internal*/ packageJsonScope?: PackageJsonInfo; 4071 4072 /* @internal */ scriptKind: ScriptKind; 4073 4074 /** 4075 * The first "most obvious" node that makes a file an external module. 4076 * This is intended to be the first top-level import/export, 4077 * but could be arbitrarily nested (e.g. `import.meta`). 4078 */ 4079 /* @internal */ externalModuleIndicator?: Node | true; 4080 /** 4081 * The callback used to set the external module indicator - this is saved to 4082 * be later reused during incremental reparsing, which otherwise lacks the information 4083 * to set this field 4084 */ 4085 /* @internal */ setExternalModuleIndicator?: (file: SourceFile) => void; 4086 // The first node that causes this file to be a CommonJS module 4087 /* @internal */ commonJsModuleIndicator?: Node; 4088 // JS identifier-declarations that are intended to merge with globals 4089 /* @internal */ jsGlobalAugmentations?: SymbolTable; 4090 4091 /* @internal */ identifiers: ESMap<string, string>; // Map from a string to an interned string 4092 /* @internal */ nodeCount: number; 4093 /* @internal */ identifierCount: number; 4094 /* @internal */ symbolCount: number; 4095 4096 // File-level diagnostics reported by the parser (includes diagnostics about /// references 4097 // as well as code diagnostics). 4098 /* @internal */ parseDiagnostics: DiagnosticWithLocation[]; 4099 4100 // File-level diagnostics reported by the binder. 4101 /* @internal */ bindDiagnostics: DiagnosticWithLocation[]; 4102 /* @internal */ bindSuggestionDiagnostics?: DiagnosticWithLocation[]; 4103 4104 // File-level JSDoc diagnostics reported by the JSDoc parser 4105 /* @internal */ jsDocDiagnostics?: DiagnosticWithLocation[]; 4106 4107 // Stores additional file-level diagnostics reported by the program 4108 /* @internal */ additionalSyntacticDiagnostics?: readonly DiagnosticWithLocation[]; 4109 4110 // Stores a line map for the file. 4111 // This field should never be used directly to obtain line map, use getLineMap function instead. 4112 /* @internal */ lineMap: readonly number[]; 4113 /* @internal */ classifiableNames?: ReadonlySet<__String>; 4114 // Comments containing @ts-* directives, in order. 4115 /* @internal */ commentDirectives?: CommentDirective[]; 4116 // Stores a mapping 'external module reference text' -> 'resolved file name' | undefined 4117 // It is used to resolve module names in the checker. 4118 // Content of this field should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead 4119 /* @internal */ resolvedModules?: ModeAwareCache<ResolvedModuleFull | undefined>; 4120 /* @internal */ resolvedTypeReferenceDirectiveNames: ModeAwareCache<ResolvedTypeReferenceDirective | undefined>; 4121 /* @internal */ imports: readonly StringLiteralLike[]; 4122 // Identifier only if `declare global` 4123 /* @internal */ moduleAugmentations: readonly (StringLiteral | Identifier)[]; 4124 /* @internal */ patternAmbientModules?: PatternAmbientModule[]; 4125 /* @internal */ ambientModuleNames: readonly string[]; 4126 /* @internal */ checkJsDirective?: CheckJsDirective; 4127 /* @internal */ version: string; 4128 /* @internal */ pragmas: ReadonlyPragmaMap; 4129 /* @internal */ localJsxNamespace?: __String; 4130 /* @internal */ localJsxFragmentNamespace?: __String; 4131 /* @internal */ localJsxFactory?: EntityName; 4132 /* @internal */ localJsxFragmentFactory?: EntityName; 4133 4134 /* @internal */ exportedModulesFromDeclarationEmit?: ExportedModulesFromDeclarationEmit; 4135 /* @internal */ endFlowNode?: FlowNode; 4136 } 4137 4138 /* @internal */ 4139 export interface CommentDirective { 4140 range: TextRange; 4141 type: CommentDirectiveType, 4142 } 4143 4144 /* @internal */ 4145 export const enum CommentDirectiveType { 4146 ExpectError, 4147 Ignore, 4148 } 4149 4150 /*@internal*/ 4151 export type ExportedModulesFromDeclarationEmit = readonly Symbol[]; 4152 4153 export interface Bundle extends Node { 4154 readonly kind: SyntaxKind.Bundle; 4155 readonly prepends: readonly (InputFiles | UnparsedSource)[]; 4156 readonly sourceFiles: readonly SourceFile[]; 4157 /* @internal */ syntheticFileReferences?: readonly FileReference[]; 4158 /* @internal */ syntheticTypeReferences?: readonly FileReference[]; 4159 /* @internal */ syntheticLibReferences?: readonly FileReference[]; 4160 /* @internal */ hasNoDefaultLib?: boolean; 4161 } 4162 4163 export interface InputFiles extends Node { 4164 readonly kind: SyntaxKind.InputFiles; 4165 javascriptPath?: string; 4166 javascriptText: string; 4167 javascriptMapPath?: string; 4168 javascriptMapText?: string; 4169 declarationPath?: string; 4170 declarationText: string; 4171 declarationMapPath?: string; 4172 declarationMapText?: string; 4173 /*@internal*/ buildInfoPath?: string; 4174 /*@internal*/ buildInfo?: BuildInfo; 4175 /*@internal*/ oldFileOfCurrentEmit?: boolean; 4176 } 4177 4178 export interface UnparsedSource extends Node { 4179 readonly kind: SyntaxKind.UnparsedSource; 4180 fileName: string; 4181 text: string; 4182 readonly prologues: readonly UnparsedPrologue[]; 4183 helpers: readonly UnscopedEmitHelper[] | undefined; 4184 4185 // References and noDefaultLibAre Dts only 4186 referencedFiles: readonly FileReference[]; 4187 typeReferenceDirectives: readonly FileReference[] | undefined; 4188 libReferenceDirectives: readonly FileReference[]; 4189 hasNoDefaultLib?: boolean; 4190 4191 sourceMapPath?: string; 4192 sourceMapText?: string; 4193 readonly syntheticReferences?: readonly UnparsedSyntheticReference[]; 4194 readonly texts: readonly UnparsedSourceText[]; 4195 /*@internal*/ oldFileOfCurrentEmit?: boolean; 4196 /*@internal*/ parsedSourceMap?: RawSourceMap | false | undefined; 4197 // Adding this to satisfy services, fix later 4198 /*@internal*/ 4199 getLineAndCharacterOfPosition(pos: number): LineAndCharacter; 4200 } 4201 4202 export type UnparsedSourceText = 4203 | UnparsedPrepend 4204 | UnparsedTextLike 4205 ; 4206 4207 export type UnparsedNode = 4208 | UnparsedPrologue 4209 | UnparsedSourceText 4210 | UnparsedSyntheticReference 4211 ; 4212 4213 export interface UnparsedSection extends Node { 4214 readonly kind: SyntaxKind; 4215 readonly parent: UnparsedSource; 4216 readonly data?: string; 4217 } 4218 4219 export interface UnparsedPrologue extends UnparsedSection { 4220 readonly kind: SyntaxKind.UnparsedPrologue; 4221 readonly parent: UnparsedSource; 4222 readonly data: string; 4223 } 4224 4225 export interface UnparsedPrepend extends UnparsedSection { 4226 readonly kind: SyntaxKind.UnparsedPrepend; 4227 readonly parent: UnparsedSource; 4228 readonly data: string; 4229 readonly texts: readonly UnparsedTextLike[]; 4230 } 4231 4232 export interface UnparsedTextLike extends UnparsedSection { 4233 readonly kind: SyntaxKind.UnparsedText | SyntaxKind.UnparsedInternalText; 4234 readonly parent: UnparsedSource; 4235 } 4236 4237 export interface UnparsedSyntheticReference extends UnparsedSection { 4238 readonly kind: SyntaxKind.UnparsedSyntheticReference; 4239 readonly parent: UnparsedSource; 4240 /*@internal*/ readonly section: BundleFileHasNoDefaultLib | BundleFileReference; 4241 } 4242 4243 export interface JsonSourceFile extends SourceFile { 4244 readonly statements: NodeArray<JsonObjectExpressionStatement>; 4245 } 4246 4247 export interface TsConfigSourceFile extends JsonSourceFile { 4248 extendedSourceFiles?: string[]; 4249 /*@internal*/ configFileSpecs?: ConfigFileSpecs; 4250 } 4251 4252 export interface JsonMinusNumericLiteral extends PrefixUnaryExpression { 4253 readonly kind: SyntaxKind.PrefixUnaryExpression; 4254 readonly operator: SyntaxKind.MinusToken; 4255 readonly operand: NumericLiteral; 4256 } 4257 4258 export type JsonObjectExpression = 4259 | ObjectLiteralExpression 4260 | ArrayLiteralExpression 4261 | JsonMinusNumericLiteral 4262 | NumericLiteral 4263 | StringLiteral 4264 | BooleanLiteral 4265 | NullLiteral 4266 ; 4267 4268 export interface JsonObjectExpressionStatement extends ExpressionStatement { 4269 readonly expression: JsonObjectExpression; 4270 } 4271 4272 export interface ScriptReferenceHost { 4273 getCompilerOptions(): CompilerOptions; 4274 getSourceFile(fileName: string): SourceFile | undefined; 4275 getSourceFileByPath(path: Path): SourceFile | undefined; 4276 getCurrentDirectory(): string; 4277 } 4278 4279 export interface ParseConfigHost { 4280 useCaseSensitiveFileNames: boolean; 4281 4282 readDirectory(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[], depth?: number): readonly string[]; 4283 4284 /** 4285 * Gets a value indicating whether the specified path exists and is a file. 4286 * @param path The path to test. 4287 */ 4288 fileExists(path: string): boolean; 4289 4290 readFile(path: string): string | undefined; 4291 trace?(s: string): void; 4292 } 4293 4294 /** 4295 * Branded string for keeping track of when we've turned an ambiguous path 4296 * specified like "./blah" to an absolute path to an actual 4297 * tsconfig file, e.g. "/root/blah/tsconfig.json" 4298 */ 4299 export type ResolvedConfigFileName = string & { _isResolvedConfigFileName: never }; 4300 4301 export interface WriteFileCallbackData { 4302 /*@internal*/ sourceMapUrlPos?: number; 4303 /*@internal*/ buildInfo?: BuildInfo; 4304 /*@internal*/ diagnostics?: readonly DiagnosticWithLocation[]; 4305 } 4306 export type WriteFileCallback = ( 4307 fileName: string, 4308 text: string, 4309 writeByteOrderMark: boolean, 4310 onError?: (message: string) => void, 4311 sourceFiles?: readonly SourceFile[], 4312 data?: WriteFileCallbackData, 4313 ) => void; 4314 4315 export class OperationCanceledException { } 4316 4317 export interface CancellationToken { 4318 isCancellationRequested(): boolean; 4319 4320 /** @throws OperationCanceledException if isCancellationRequested is true */ 4321 throwIfCancellationRequested(): void; 4322 } 4323 4324 /*@internal*/ 4325 export enum FileIncludeKind { 4326 RootFile, 4327 SourceFromProjectReference, 4328 OutputFromProjectReference, 4329 Import, 4330 ReferenceFile, 4331 TypeReferenceDirective, 4332 LibFile, 4333 LibReferenceDirective, 4334 AutomaticTypeDirectiveFile 4335 } 4336 4337 /*@internal*/ 4338 export interface RootFile { 4339 kind: FileIncludeKind.RootFile, 4340 index: number; 4341 } 4342 4343 /*@internal*/ 4344 export interface LibFile { 4345 kind: FileIncludeKind.LibFile; 4346 index?: number; 4347 } 4348 4349 /*@internal*/ 4350 export type ProjectReferenceFileKind = FileIncludeKind.SourceFromProjectReference | 4351 FileIncludeKind.OutputFromProjectReference; 4352 4353 /*@internal*/ 4354 export interface ProjectReferenceFile { 4355 kind: ProjectReferenceFileKind; 4356 index: number; 4357 } 4358 4359 /*@internal*/ 4360 export type ReferencedFileKind = FileIncludeKind.Import | 4361 FileIncludeKind.ReferenceFile | 4362 FileIncludeKind.TypeReferenceDirective | 4363 FileIncludeKind.LibReferenceDirective; 4364 4365 /*@internal*/ 4366 export interface ReferencedFile { 4367 kind: ReferencedFileKind; 4368 file: Path; 4369 index: number; 4370 } 4371 4372 /*@internal*/ 4373 export interface AutomaticTypeDirectiveFile { 4374 kind: FileIncludeKind.AutomaticTypeDirectiveFile; 4375 typeReference: string; 4376 packageId: PackageId | undefined; 4377 } 4378 4379 /*@internal*/ 4380 export type FileIncludeReason = 4381 RootFile | 4382 LibFile | 4383 ProjectReferenceFile | 4384 ReferencedFile | 4385 AutomaticTypeDirectiveFile; 4386 4387 /*@internal*/ 4388 export const enum FilePreprocessingDiagnosticsKind { 4389 FilePreprocessingReferencedDiagnostic, 4390 FilePreprocessingFileExplainingDiagnostic 4391 } 4392 4393 /*@internal*/ 4394 export interface FilePreprocessingReferencedDiagnostic { 4395 kind: FilePreprocessingDiagnosticsKind.FilePreprocessingReferencedDiagnostic; 4396 reason: ReferencedFile; 4397 diagnostic: DiagnosticMessage; 4398 args?: (string | number | undefined)[]; 4399 } 4400 4401 /*@internal*/ 4402 export interface FilePreprocessingFileExplainingDiagnostic { 4403 kind: FilePreprocessingDiagnosticsKind.FilePreprocessingFileExplainingDiagnostic; 4404 file?: Path; 4405 fileProcessingReason: FileIncludeReason; 4406 diagnostic: DiagnosticMessage; 4407 args?: (string | number | undefined)[]; 4408 } 4409 4410 /*@internal*/ 4411 export type FilePreprocessingDiagnostics = FilePreprocessingReferencedDiagnostic | FilePreprocessingFileExplainingDiagnostic; 4412 4413 export interface SymbolDisplayPart { 4414 text: string; 4415 kind: string; 4416 } 4417 export interface JsDocTagInfo { 4418 name: string; 4419 text?: string | SymbolDisplayPart[]; 4420 } 4421 4422 export interface Program extends ScriptReferenceHost { 4423 getCurrentDirectory(): string; 4424 /** 4425 * Get a list of root file names that were passed to a 'createProgram' 4426 */ 4427 getRootFileNames(): readonly string[]; 4428 4429 /** 4430 * Get a list of files in the program 4431 */ 4432 getSourceFiles(): readonly SourceFile[]; 4433 4434 /** 4435 * Get a list of file names that were passed to 'createProgram' or referenced in a 4436 * program source file but could not be located. 4437 */ 4438 /* @internal */ 4439 getMissingFilePaths(): readonly Path[]; 4440 /* @internal */ 4441 getModuleResolutionCache(): ModuleResolutionCache | undefined; 4442 /* @internal */ 4443 getFilesByNameMap(): ESMap<string, SourceFile | false | undefined>; 4444 4445 /** 4446 * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then 4447 * the JavaScript and declaration files will be produced for all the files in this program. 4448 * If targetSourceFile is specified, then only the JavaScript and declaration for that 4449 * specific file will be generated. 4450 * 4451 * If writeFile is not specified then the writeFile callback from the compiler host will be 4452 * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter 4453 * will be invoked when writing the JavaScript and declaration files. 4454 */ 4455 emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult; 4456 /*@internal*/ 4457 emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers, forceDtsEmit?: boolean): EmitResult; // eslint-disable-line @typescript-eslint/unified-signatures 4458 4459 getOptionsDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; 4460 getGlobalDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; 4461 getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; 4462 /** The first time this is called, it will return global diagnostics (no location). */ 4463 getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[]; 4464 getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; 4465 getConfigFileParsingDiagnostics(): readonly Diagnostic[]; 4466 /* @internal */ getSuggestionDiagnostics(sourceFile: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; 4467 4468 /* @internal */ getBindAndCheckDiagnostics(sourceFile: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[]; 4469 /* @internal */ getProgramDiagnostics(sourceFile: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[]; 4470 4471 getEtsLibSFromProgram(): string[]; 4472 /** 4473 * Gets a type checker that can be used to semantically analyze source files in the program. 4474 */ 4475 getTypeChecker(): TypeChecker; 4476 4477 /* @internal */ getCommonSourceDirectory(): string; 4478 4479 /* @internal */ getCachedSemanticDiagnostics(sourceFile?: SourceFile): readonly Diagnostic[] | undefined; 4480 4481 /* @internal */ getClassifiableNames(): Set<__String>; 4482 4483 getNodeCount(): number; 4484 getIdentifierCount(): number; 4485 getSymbolCount(): number; 4486 getTypeCount(): number; 4487 getInstantiationCount(): number; 4488 getRelationCacheSizes(): { assignable: number, identity: number, subtype: number, strictSubtype: number }; 4489 4490 /* @internal */ getFileProcessingDiagnostics(): FilePreprocessingDiagnostics[] | undefined; 4491 /* @internal */ getResolvedTypeReferenceDirectives(): ModeAwareCache<ResolvedTypeReferenceDirective | undefined>; 4492 isSourceFileFromExternalLibrary(file: SourceFile): boolean; 4493 isSourceFileDefaultLibrary(file: SourceFile): boolean; 4494 4495 // For testing purposes only. 4496 // This is set on created program to let us know how the program was created using old program 4497 /* @internal */ readonly structureIsReused: StructureIsReused; 4498 4499 getSourceFileFromReference(referencingFile: SourceFile | UnparsedSource, ref: FileReference): SourceFile | undefined; 4500 /* @internal */ getLibFileFromReference(ref: FileReference): SourceFile | undefined; 4501 4502 /** Given a source file, get the name of the package it was imported from. */ 4503 /* @internal */ sourceFileToPackageName: ESMap<Path, string>; 4504 /** Set of all source files that some other source file redirects to. */ 4505 /* @internal */ redirectTargetsMap: MultiMap<Path, string>; 4506 /** Whether any (non-external, non-declaration) source files use `node:`-prefixed module specifiers. */ 4507 /* @internal */ readonly usesUriStyleNodeCoreModules: boolean; 4508 /** Is the file emitted file */ 4509 /* @internal */ isEmittedFile(file: string): boolean; 4510 /* @internal */ getFileIncludeReasons(): MultiMap<Path, FileIncludeReason>; 4511 /* @internal */ useCaseSensitiveFileNames(): boolean; 4512 4513 /* @internal */ getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string, mode?: ModuleKind.CommonJS | ModuleKind.ESNext): ResolvedModuleWithFailedLookupLocations | undefined; 4514 4515 getProjectReferences(): readonly ProjectReference[] | undefined; 4516 getResolvedProjectReferences(): readonly (ResolvedProjectReference | undefined)[] | undefined; 4517 /*@internal*/ getProjectReferenceRedirect(fileName: string): string | undefined; 4518 /*@internal*/ getResolvedProjectReferenceToRedirect(fileName: string): ResolvedProjectReference | undefined; 4519 /*@internal*/ forEachResolvedProjectReference<T>(cb: (resolvedProjectReference: ResolvedProjectReference) => T | undefined): T | undefined; 4520 /*@internal*/ getResolvedProjectReferenceByPath(projectReferencePath: Path): ResolvedProjectReference | undefined; 4521 /*@internal*/ isSourceOfProjectReferenceRedirect(fileName: string): boolean; 4522 /*@internal*/ getProgramBuildInfo?(): ProgramBuildInfo | undefined; 4523 /*@internal*/ emitBuildInfo(writeFile?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult; 4524 /** 4525 * This implementation handles file exists to be true if file is source of project reference redirect when program is created using useSourceOfProjectReferenceRedirect 4526 */ 4527 /*@internal*/ fileExists(fileName: string): boolean; 4528 /** Call compilerHost.writeFile on host program was created with */ 4529 /*@internal*/ writeFile: WriteFileCallback; 4530 getJsDocNodeCheckedConfig?(jsDocFileCheckInfo: FileCheckModuleInfo, symbolSourceFilePath: string): JsDocNodeCheckConfig; 4531 getJsDocNodeConditionCheckedResult?(jsDocFileCheckedInfo: FileCheckModuleInfo, jsDocs: JsDocTagInfo[]): ConditionCheckResult; 4532 getFileCheckedModuleInfo?(containFilePath: string): FileCheckModuleInfo; 4533 } 4534 4535 /*@internal*/ 4536 export interface Program extends TypeCheckerHost, ModuleSpecifierResolutionHost { 4537 } 4538 4539 export type RedirectTargetsMap = ReadonlyESMap<Path, readonly string[]>; 4540 4541 export interface ResolvedProjectReference { 4542 commandLine: ParsedCommandLine; 4543 sourceFile: SourceFile; 4544 references?: readonly (ResolvedProjectReference | undefined)[]; 4545 } 4546 4547 /* @internal */ 4548 export const enum StructureIsReused { 4549 Not, 4550 SafeModules, 4551 Completely, 4552 } 4553 4554 export type CustomTransformerFactory = (context: TransformationContext) => CustomTransformer; 4555 4556 export interface CustomTransformer { 4557 transformSourceFile(node: SourceFile): SourceFile; 4558 transformBundle(node: Bundle): Bundle; 4559 } 4560 4561 export interface CustomTransformers { 4562 /** Custom transformers to evaluate before built-in .js transformations. */ 4563 before?: (TransformerFactory<SourceFile> | CustomTransformerFactory)[]; 4564 /** Custom transformers to evaluate after built-in .js transformations. */ 4565 after?: (TransformerFactory<SourceFile> | CustomTransformerFactory)[]; 4566 /** Custom transformers to evaluate after built-in .d.ts transformations. */ 4567 afterDeclarations?: (TransformerFactory<Bundle | SourceFile> | CustomTransformerFactory)[]; 4568 } 4569 4570 /*@internal*/ 4571 export interface EmitTransformers { 4572 scriptTransformers: readonly TransformerFactory<SourceFile | Bundle>[]; 4573 declarationTransformers: readonly TransformerFactory<SourceFile | Bundle>[]; 4574 } 4575 4576 export interface SourceMapSpan { 4577 /** Line number in the .js file. */ 4578 emittedLine: number; 4579 /** Column number in the .js file. */ 4580 emittedColumn: number; 4581 /** Line number in the .ts file. */ 4582 sourceLine: number; 4583 /** Column number in the .ts file. */ 4584 sourceColumn: number; 4585 /** Optional name (index into names array) associated with this span. */ 4586 nameIndex?: number; 4587 /** .ts file (index into sources array) associated with this span */ 4588 sourceIndex: number; 4589 } 4590 4591 /* @internal */ 4592 export interface SourceMapEmitResult { 4593 inputSourceFileNames: readonly string[]; // Input source file (which one can use on program to get the file), 1:1 mapping with the sourceMap.sources list 4594 sourceMap: RawSourceMap; 4595 } 4596 4597 /** Return code used by getEmitOutput function to indicate status of the function */ 4598 export enum ExitStatus { 4599 // Compiler ran successfully. Either this was a simple do-nothing compilation (for example, 4600 // when -version or -help was provided, or this was a normal compilation, no diagnostics 4601 // were produced, and all outputs were generated successfully. 4602 Success = 0, 4603 4604 // Diagnostics were produced and because of them no code was generated. 4605 DiagnosticsPresent_OutputsSkipped = 1, 4606 4607 // Diagnostics were produced and outputs were generated in spite of them. 4608 DiagnosticsPresent_OutputsGenerated = 2, 4609 4610 // When build skipped because passed in project is invalid 4611 InvalidProject_OutputsSkipped = 3, 4612 4613 // When build is skipped because project references form cycle 4614 ProjectReferenceCycle_OutputsSkipped = 4, 4615 4616 /** @deprecated Use ProjectReferenceCycle_OutputsSkipped instead. */ 4617 ProjectReferenceCycle_OutputsSkupped = 4, 4618 } 4619 4620 export interface EmitResult { 4621 emitSkipped: boolean; 4622 /** Contains declaration emit diagnostics */ 4623 diagnostics: readonly Diagnostic[]; 4624 emittedFiles?: string[]; // Array of files the compiler wrote to disk 4625 /* @internal */ sourceMaps?: SourceMapEmitResult[]; // Array of sourceMapData if compiler emitted sourcemaps 4626 } 4627 4628 /* @internal */ 4629 export interface TypeCheckerHost extends ModuleSpecifierResolutionHost { 4630 getCompilerOptions(): CompilerOptions; 4631 4632 getSourceFiles(): readonly SourceFile[]; 4633 getSourceFile(fileName: string): SourceFile | undefined; 4634 getResolvedTypeReferenceDirectives(): ModeAwareCache<ResolvedTypeReferenceDirective | undefined>; 4635 getProjectReferenceRedirect(fileName: string): string | undefined; 4636 isSourceOfProjectReferenceRedirect(fileName: string): boolean; 4637 4638 readonly redirectTargetsMap: RedirectTargetsMap; 4639 4640 getJsDocNodeCheckedConfig?(fileCheckedInfo: FileCheckModuleInfo, symbolSourceFilePath: string): JsDocNodeCheckConfig; 4641 getJsDocNodeConditionCheckedResult?(fileCheckedInfo: FileCheckModuleInfo, jsDocs: JsDocTagInfo[]): ConditionCheckResult; 4642 getFileCheckedModuleInfo?(containFilePath: string): FileCheckModuleInfo; 4643 } 4644 4645 export interface TypeChecker { 4646 getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; 4647 /* @internal */ getTypeOfSymbol(symbol: Symbol): Type; 4648 getDeclaredTypeOfSymbol(symbol: Symbol): Type; 4649 getPropertiesOfType(type: Type): Symbol[]; 4650 getPropertyOfType(type: Type, propertyName: string): Symbol | undefined; 4651 getPrivateIdentifierPropertyOfType(leftType: Type, name: string, location: Node): Symbol | undefined; 4652 /* @internal */ getTypeOfPropertyOfType(type: Type, propertyName: string): Type | undefined; 4653 getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo | undefined; 4654 getIndexInfosOfType(type: Type): readonly IndexInfo[]; 4655 getIndexInfosOfIndexSymbol: (indexSymbol: Symbol) => IndexInfo[]; 4656 getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[]; 4657 getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined; 4658 /* @internal */ getIndexType(type: Type): Type; 4659 getBaseTypes(type: InterfaceType): BaseType[]; 4660 getBaseTypeOfLiteralType(type: Type): Type; 4661 getWidenedType(type: Type): Type; 4662 /* @internal */ 4663 getPromisedTypeOfPromise(promise: Type, errorNode?: Node): Type | undefined; 4664 /* @internal */ 4665 getAwaitedType(type: Type): Type | undefined; 4666 getReturnTypeOfSignature(signature: Signature): Type; 4667 /** 4668 * Gets the type of a parameter at a given position in a signature. 4669 * Returns `any` if the index is not valid. 4670 */ 4671 /* @internal */ getParameterType(signature: Signature, parameterIndex: number): Type; 4672 /* @internal */ getParameterIdentifierNameAtPosition(signature: Signature, parameterIndex: number): [parameterName: __String, isRestParameter: boolean] | undefined; 4673 getNullableType(type: Type, flags: TypeFlags): Type; 4674 getNonNullableType(type: Type): Type; 4675 /* @internal */ getNonOptionalType(type: Type): Type; 4676 /* @internal */ isNullableType(type: Type): boolean; 4677 getTypeArguments(type: TypeReference): readonly Type[]; 4678 4679 // TODO: GH#18217 `xToDeclaration` calls are frequently asserted as defined. 4680 /** Note that the resulting nodes cannot be checked. */ 4681 typeToTypeNode(type: Type, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): TypeNode | undefined; 4682 /* @internal */ typeToTypeNode(type: Type, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined, tracker?: SymbolTracker): TypeNode | undefined; // eslint-disable-line @typescript-eslint/unified-signatures 4683 /** Note that the resulting nodes cannot be checked. */ 4684 signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): SignatureDeclaration & {typeArguments?: NodeArray<TypeNode>} | undefined; 4685 /* @internal */ signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined, tracker?: SymbolTracker): SignatureDeclaration & {typeArguments?: NodeArray<TypeNode>} | undefined; // eslint-disable-line @typescript-eslint/unified-signatures 4686 /** Note that the resulting nodes cannot be checked. */ 4687 indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): IndexSignatureDeclaration | undefined; 4688 /* @internal */ indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined, tracker?: SymbolTracker): IndexSignatureDeclaration | undefined; // eslint-disable-line @typescript-eslint/unified-signatures 4689 /** Note that the resulting nodes cannot be checked. */ 4690 symbolToEntityName(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): EntityName | undefined; 4691 /** Note that the resulting nodes cannot be checked. */ 4692 symbolToExpression(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): Expression | undefined; 4693 /** Note that the resulting nodes cannot be checked. */ 4694 /* @internal */ symbolToNode(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): Node | undefined; 4695 /** Note that the resulting nodes cannot be checked. */ 4696 symbolToTypeParameterDeclarations(symbol: Symbol, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): NodeArray<TypeParameterDeclaration> | undefined; 4697 /** Note that the resulting nodes cannot be checked. */ 4698 symbolToParameterDeclaration(symbol: Symbol, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): ParameterDeclaration | undefined; 4699 /** Note that the resulting nodes cannot be checked. */ 4700 typeParameterToDeclaration(parameter: TypeParameter, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): TypeParameterDeclaration | undefined; 4701 4702 getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; 4703 getSymbolAtLocation(node: Node): Symbol | undefined; 4704 /* @internal */ getIndexInfosAtLocation(node: Node): readonly IndexInfo[] | undefined; 4705 getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; 4706 /** 4707 * The function returns the value (local variable) symbol of an identifier in the short-hand property assignment. 4708 * This is necessary as an identifier in short-hand property assignment can contains two meaning: property name and property value. 4709 */ 4710 getShorthandAssignmentValueSymbol(location: Node | undefined): Symbol | undefined; 4711 4712 getExportSpecifierLocalTargetSymbol(location: ExportSpecifier | Identifier): Symbol | undefined; 4713 /** 4714 * If a symbol is a local symbol with an associated exported symbol, returns the exported symbol. 4715 * Otherwise returns its input. 4716 * For example, at `export type T = number;`: 4717 * - `getSymbolAtLocation` at the location `T` will return the exported symbol for `T`. 4718 * - But the result of `getSymbolsInScope` will contain the *local* symbol for `T`, not the exported symbol. 4719 * - Calling `getExportSymbolOfSymbol` on that local symbol will return the exported symbol. 4720 */ 4721 getExportSymbolOfSymbol(symbol: Symbol): Symbol; 4722 getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined; 4723 getTypeOfAssignmentPattern(pattern: AssignmentPattern): Type; 4724 getTypeAtLocation(node: Node): Type; 4725 tryGetTypeAtLocationWithoutCheck(node: Node): Type; 4726 getTypeFromTypeNode(node: TypeNode): Type; 4727 4728 signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; 4729 typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; 4730 symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): string; 4731 typePredicateToString(predicate: TypePredicate, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; 4732 4733 /* @internal */ writeSignature(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind, writer?: EmitTextWriter): string; 4734 /* @internal */ writeType(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags, writer?: EmitTextWriter): string; 4735 /* @internal */ writeSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags, writer?: EmitTextWriter): string; 4736 /* @internal */ writeTypePredicate(predicate: TypePredicate, enclosingDeclaration?: Node, flags?: TypeFormatFlags, writer?: EmitTextWriter): string; 4737 4738 getFullyQualifiedName(symbol: Symbol): string; 4739 getAugmentedPropertiesOfType(type: Type): Symbol[]; 4740 4741 getRootSymbols(symbol: Symbol): readonly Symbol[]; 4742 getSymbolOfExpando(node: Node, allowDeclaration: boolean): Symbol | undefined; 4743 getContextualType(node: Expression): Type | undefined; 4744 /* @internal */ getContextualType(node: Expression, contextFlags?: ContextFlags): Type | undefined; // eslint-disable-line @typescript-eslint/unified-signatures 4745 /* @internal */ getContextualTypeForObjectLiteralElement(element: ObjectLiteralElementLike): Type | undefined; 4746 /* @internal */ getContextualTypeForArgumentAtIndex(call: CallLikeExpression, argIndex: number): Type | undefined; 4747 /* @internal */ getContextualTypeForJsxAttribute(attribute: JsxAttribute | JsxSpreadAttribute): Type | undefined; 4748 /* @internal */ isContextSensitive(node: Expression | MethodDeclaration | ObjectLiteralElementLike | JsxAttributeLike): boolean; 4749 /* @internal */ getTypeOfPropertyOfContextualType(type: Type, name: __String): Type | undefined; 4750 4751 /** 4752 * returns unknownSignature in the case of an error. 4753 * returns undefined if the node is not valid. 4754 * @param argumentCount Apparent number of arguments, passed in case of a possibly incomplete call. This should come from an ArgumentListInfo. See `signatureHelp.ts`. 4755 */ 4756 getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature | undefined; 4757 tryGetResolvedSignatureWithoutCheck(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature | undefined; 4758 /* @internal */ getResolvedSignatureForSignatureHelp(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature | undefined; 4759 /* @internal */ getResolvedSignatureForStringLiteralCompletions(call: CallLikeExpression, editingArgument: Node, candidatesOutArray: Signature[]): Signature | undefined; 4760 /* @internal */ getExpandedParameters(sig: Signature): readonly (readonly Symbol[])[]; 4761 /* @internal */ hasEffectiveRestParameter(sig: Signature): boolean; 4762 /* @internal */ containsArgumentsReference(declaration: SignatureDeclaration): boolean; 4763 4764 getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature | undefined; 4765 isImplementationOfOverload(node: SignatureDeclaration): boolean | undefined; 4766 isUndefinedSymbol(symbol: Symbol): boolean; 4767 isArgumentsSymbol(symbol: Symbol): boolean; 4768 isUnknownSymbol(symbol: Symbol): boolean; 4769 /* @internal */ getMergedSymbol(symbol: Symbol): Symbol; 4770 4771 getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined; 4772 isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName | ImportTypeNode, propertyName: string): boolean; 4773 /** Exclude accesses to private properties. */ 4774 /* @internal */ isValidPropertyAccessForCompletions(node: PropertyAccessExpression | ImportTypeNode | QualifiedName, type: Type, property: Symbol): boolean; 4775 /** Follow all aliases to get the original symbol. */ 4776 getAliasedSymbol(symbol: Symbol): Symbol; 4777 /** Follow a *single* alias to get the immediately aliased symbol. */ 4778 getImmediateAliasedSymbol(symbol: Symbol): Symbol | undefined; 4779 getExportsOfModule(moduleSymbol: Symbol): Symbol[]; 4780 /** Unlike `getExportsOfModule`, this includes properties of an `export =` value. */ 4781 /* @internal */ getExportsAndPropertiesOfModule(moduleSymbol: Symbol): Symbol[]; 4782 /* @internal */ forEachExportAndPropertyOfModule(moduleSymbol: Symbol, cb: (symbol: Symbol, key: __String) => void): void; 4783 getJsxIntrinsicTagNamesAt(location: Node): Symbol[]; 4784 isOptionalParameter(node: ParameterDeclaration): boolean; 4785 getAmbientModules(): Symbol[]; 4786 4787 tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined; 4788 /** 4789 * Unlike `tryGetMemberInModuleExports`, this includes properties of an `export =` value. 4790 * Does *not* return properties of primitive types. 4791 */ 4792 /* @internal */ tryGetMemberInModuleExportsAndProperties(memberName: string, moduleSymbol: Symbol): Symbol | undefined; 4793 getApparentType(type: Type): Type; 4794 /* @internal */ getSuggestedSymbolForNonexistentProperty(name: MemberName | string, containingType: Type): Symbol | undefined; 4795 /* @internal */ getSuggestedSymbolForNonexistentJSXAttribute(name: Identifier | string, containingType: Type): Symbol | undefined; 4796 /* @internal */ getSuggestionForNonexistentProperty(name: MemberName | string, containingType: Type): string | undefined; 4797 /* @internal */ getSuggestedSymbolForNonexistentSymbol(location: Node, name: string, meaning: SymbolFlags): Symbol | undefined; 4798 /* @internal */ getSuggestionForNonexistentSymbol(location: Node, name: string, meaning: SymbolFlags): string | undefined; 4799 /* @internal */ getSuggestedSymbolForNonexistentModule(node: Identifier, target: Symbol): Symbol | undefined; 4800 /* @internal */ getSuggestedSymbolForNonexistentClassMember(name: string, baseType: Type): Symbol | undefined; 4801 /* @internal */ getSuggestionForNonexistentExport(node: Identifier, target: Symbol): string | undefined; 4802 getBaseConstraintOfType(type: Type): Type | undefined; 4803 getDefaultFromTypeParameter(type: Type): Type | undefined; 4804 4805 /* @internal */ getAnyType(): Type; 4806 /* @internal */ getStringType(): Type; 4807 /* @internal */ getNumberType(): Type; 4808 /* @internal */ getBooleanType(): Type; 4809 /* @internal */ getFalseType(fresh?: boolean): Type; 4810 /* @internal */ getTrueType(fresh?: boolean): Type; 4811 /* @internal */ getVoidType(): Type; 4812 /* @internal */ getUndefinedType(): Type; 4813 /* @internal */ getNullType(): Type; 4814 /* @internal */ getESSymbolType(): Type; 4815 /* @internal */ getNeverType(): Type; 4816 /* @internal */ getOptionalType(): Type; 4817 /* @internal */ getUnionType(types: Type[], subtypeReduction?: UnionReduction): Type; 4818 /* @internal */ createArrayType(elementType: Type): Type; 4819 /* @internal */ getElementTypeOfArrayType(arrayType: Type): Type | undefined; 4820 /* @internal */ createPromiseType(type: Type): Type; 4821 /* @internal */ getPromiseType(): Type; 4822 /* @internal */ getPromiseLikeType(): Type; 4823 /* @internal */ getAsyncIterableType(): Type | undefined; 4824 4825 /* @internal */ isTypeAssignableTo(source: Type, target: Type): boolean; 4826 /* @internal */ createAnonymousType(symbol: Symbol | undefined, members: SymbolTable, callSignatures: Signature[], constructSignatures: Signature[], indexInfos: IndexInfo[]): Type; 4827 /* @internal */ createSignature( 4828 declaration: SignatureDeclaration | undefined, 4829 typeParameters: readonly TypeParameter[] | undefined, 4830 thisParameter: Symbol | undefined, 4831 parameters: readonly Symbol[], 4832 resolvedReturnType: Type, 4833 typePredicate: TypePredicate | undefined, 4834 minArgumentCount: number, 4835 flags: SignatureFlags 4836 ): Signature; 4837 /* @internal */ createSymbol(flags: SymbolFlags, name: __String): TransientSymbol; 4838 /* @internal */ createIndexInfo(keyType: Type, type: Type, isReadonly: boolean, declaration?: SignatureDeclaration): IndexInfo; 4839 /* @internal */ isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node | undefined, meaning: SymbolFlags, shouldComputeAliasToMarkVisible: boolean): SymbolAccessibilityResult; 4840 /* @internal */ tryFindAmbientModule(moduleName: string): Symbol | undefined; 4841 /* @internal */ tryFindAmbientModuleWithoutAugmentations(moduleName: string): Symbol | undefined; 4842 4843 /* @internal */ getSymbolWalker(accept?: (symbol: Symbol) => boolean): SymbolWalker; 4844 4845 // Should not be called directly. Should only be accessed through the Program instance. 4846 /* @internal */ getDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; 4847 /* @internal */ getGlobalDiagnostics(): Diagnostic[]; 4848 /* @internal */ getEmitResolver(sourceFile?: SourceFile, cancellationToken?: CancellationToken): EmitResolver; 4849 4850 /* @internal */ getNodeCount(): number; 4851 /* @internal */ getIdentifierCount(): number; 4852 /* @internal */ getSymbolCount(): number; 4853 /* @internal */ getTypeCount(): number; 4854 /* @internal */ getInstantiationCount(): number; 4855 /* @internal */ getRelationCacheSizes(): { assignable: number, identity: number, subtype: number, strictSubtype: number }; 4856 /* @internal */ getRecursionIdentity(type: Type): object | undefined; 4857 /* @internal */ getUnmatchedProperties(source: Type, target: Type, requireOptionalProperties: boolean, matchDiscriminantProperties: boolean): IterableIterator<Symbol>; 4858 4859 /* @internal */ isArrayType(type: Type): boolean; 4860 /* @internal */ isTupleType(type: Type): boolean; 4861 /* @internal */ isArrayLikeType(type: Type): boolean; 4862 4863 /** 4864 * True if `contextualType` should not be considered for completions because 4865 * e.g. it specifies `kind: "a"` and obj has `kind: "b"`. 4866 */ 4867 /* @internal */ isTypeInvalidDueToUnionDiscriminant(contextualType: Type, obj: ObjectLiteralExpression | JsxAttributes): boolean; 4868 /* @internal */ getExactOptionalProperties(type: Type): Symbol[]; 4869 /** 4870 * For a union, will include a property if it's defined in *any* of the member types. 4871 * So for `{ a } | { b }`, this will include both `a` and `b`. 4872 * Does not include properties of primitive types. 4873 */ 4874 /* @internal */ getAllPossiblePropertiesOfTypes(type: readonly Type[]): Symbol[]; 4875 /* @internal */ resolveName(name: string, location: Node | undefined, meaning: SymbolFlags, excludeGlobals: boolean): Symbol | undefined; 4876 /* @internal */ getJsxNamespace(location?: Node): string; 4877 /* @internal */ getJsxFragmentFactory(location: Node): string | undefined; 4878 4879 /** 4880 * Note that this will return undefined in the following case: 4881 * // a.ts 4882 * export namespace N { export class C { } } 4883 * // b.ts 4884 * <<enclosingDeclaration>> 4885 * Where `C` is the symbol we're looking for. 4886 * This should be called in a loop climbing parents of the symbol, so we'll get `N`. 4887 */ 4888 /* @internal */ getAccessibleSymbolChain(symbol: Symbol, enclosingDeclaration: Node | undefined, meaning: SymbolFlags, useOnlyExternalAliasing: boolean): Symbol[] | undefined; 4889 getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined; 4890 /* @internal */ resolveExternalModuleName(moduleSpecifier: Expression): Symbol | undefined; 4891 /** 4892 * An external module with an 'export =' declaration resolves to the target of the 'export =' declaration, 4893 * and an external module with no 'export =' declaration resolves to the module itself. 4894 */ 4895 /* @internal */ resolveExternalModuleSymbol(symbol: Symbol): Symbol; 4896 /** @param node A location where we might consider accessing `this`. Not necessarily a ThisExpression. */ 4897 /* @internal */ tryGetThisTypeAt(node: Node, includeGlobalThis?: boolean, container?: Node): Type | undefined; 4898 /* @internal */ getTypeArgumentConstraint(node: TypeNode): Type | undefined; 4899 4900 /** 4901 * Does *not* get *all* suggestion diagnostics, just the ones that were convenient to report in the checker. 4902 * Others are added in computeSuggestionDiagnostics. 4903 */ 4904 /* @internal */ getSuggestionDiagnostics(file: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; 4905 4906 /** 4907 * Depending on the operation performed, it may be appropriate to throw away the checker 4908 * if the cancellation token is triggered. Typically, if it is used for error checking 4909 * and the operation is cancelled, then it should be discarded, otherwise it is safe to keep. 4910 */ 4911 runWithCancellationToken<T>(token: CancellationToken, cb: (checker: TypeChecker) => T): T; 4912 4913 /* @internal */ getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol: Symbol): readonly TypeParameter[] | undefined; 4914 /* @internal */ isDeclarationVisible(node: Declaration | AnyImportSyntax): boolean; 4915 /* @internal */ isPropertyAccessible(node: Node, isSuper: boolean, isWrite: boolean, containingType: Type, property: Symbol): boolean; 4916 /* @internal */ getTypeOnlyAliasDeclaration(symbol: Symbol): TypeOnlyAliasDeclaration | undefined; 4917 /* @internal */ getMemberOverrideModifierStatus(node: ClassLikeDeclaration, member: ClassElement): MemberOverrideStatus; 4918 /* @internal */ isTypeParameterPossiblyReferenced(tp: TypeParameter, node: Node): boolean; 4919 } 4920 4921 /* @internal */ 4922 export const enum MemberOverrideStatus { 4923 Ok, 4924 NeedsOverride, 4925 HasInvalidOverride 4926 } 4927 4928 /* @internal */ 4929 export const enum UnionReduction { 4930 None = 0, 4931 Literal, 4932 Subtype, 4933 } 4934 4935 /* @internal */ 4936 export const enum ContextFlags { 4937 None = 0, 4938 Signature = 1 << 0, // Obtaining contextual signature 4939 NoConstraints = 1 << 1, // Don't obtain type variable constraints 4940 Completions = 1 << 2, // Ignore inference to current node and parent nodes out to the containing call for completions 4941 SkipBindingPatterns = 1 << 3, // Ignore contextual types applied by binding patterns 4942 } 4943 4944 // NOTE: If modifying this enum, must modify `TypeFormatFlags` too! 4945 export const enum NodeBuilderFlags { 4946 None = 0, 4947 // Options 4948 NoTruncation = 1 << 0, // Don't truncate result 4949 WriteArrayAsGenericType = 1 << 1, // Write Array<T> instead T[] 4950 GenerateNamesForShadowedTypeParams = 1 << 2, // When a type parameter T is shadowing another T, generate a name for it so it can still be referenced 4951 UseStructuralFallback = 1 << 3, // When an alias cannot be named by its symbol, rather than report an error, fallback to a structural printout if possible 4952 ForbidIndexedAccessSymbolReferences = 1 << 4, // Forbid references like `I["a"]["b"]` - print `typeof I.a<x>.b<y>` instead 4953 WriteTypeArgumentsOfSignature = 1 << 5, // Write the type arguments instead of type parameters of the signature 4954 UseFullyQualifiedType = 1 << 6, // Write out the fully qualified type name (eg. Module.Type, instead of Type) 4955 UseOnlyExternalAliasing = 1 << 7, // Only use external aliases for a symbol 4956 SuppressAnyReturnType = 1 << 8, // If the return type is any-like and can be elided, don't offer a return type. 4957 WriteTypeParametersInQualifiedName = 1 << 9, 4958 MultilineObjectLiterals = 1 << 10, // Always write object literals across multiple lines 4959 WriteClassExpressionAsTypeLiteral = 1 << 11, // Write class {} as { new(): {} } - used for mixin declaration emit 4960 UseTypeOfFunction = 1 << 12, // Build using typeof instead of function type literal 4961 OmitParameterModifiers = 1 << 13, // Omit modifiers on parameters 4962 UseAliasDefinedOutsideCurrentScope = 1 << 14, // Allow non-visible aliases 4963 UseSingleQuotesForStringLiteralType = 1 << 28, // Use single quotes for string literal type 4964 NoTypeReduction = 1 << 29, // Don't call getReducedType 4965 OmitThisParameter = 1 << 25, 4966 4967 // Error handling 4968 AllowThisInObjectLiteral = 1 << 15, 4969 AllowQualifiedNameInPlaceOfIdentifier = 1 << 16, 4970 /** @deprecated AllowQualifedNameInPlaceOfIdentifier. Use AllowQualifiedNameInPlaceOfIdentifier instead. */ 4971 AllowQualifedNameInPlaceOfIdentifier = AllowQualifiedNameInPlaceOfIdentifier, 4972 AllowAnonymousIdentifier = 1 << 17, 4973 AllowEmptyUnionOrIntersection = 1 << 18, 4974 AllowEmptyTuple = 1 << 19, 4975 AllowUniqueESSymbolType = 1 << 20, 4976 AllowEmptyIndexInfoType = 1 << 21, 4977 /* @internal */ WriteComputedProps = 1 << 30, // { [E.A]: 1 } 4978 4979 // Errors (cont.) 4980 AllowNodeModulesRelativePaths = 1 << 26, 4981 /* @internal */ DoNotIncludeSymbolChain = 1 << 27, // Skip looking up and printing an accessible symbol chain 4982 4983 IgnoreErrors = AllowThisInObjectLiteral | AllowQualifiedNameInPlaceOfIdentifier | AllowAnonymousIdentifier | AllowEmptyUnionOrIntersection | AllowEmptyTuple | AllowEmptyIndexInfoType | AllowNodeModulesRelativePaths, 4984 4985 // State 4986 InObjectTypeLiteral = 1 << 22, 4987 InTypeAlias = 1 << 23, // Writing type in type alias declaration 4988 InInitialEntityName = 1 << 24, // Set when writing the LHS of an entity name or entity name expression 4989 } 4990 4991 // Ensure the shared flags between this and `NodeBuilderFlags` stay in alignment 4992 export const enum TypeFormatFlags { 4993 None = 0, 4994 NoTruncation = 1 << 0, // Don't truncate typeToString result 4995 WriteArrayAsGenericType = 1 << 1, // Write Array<T> instead T[] 4996 // hole because there's a hole in node builder flags 4997 UseStructuralFallback = 1 << 3, // When an alias cannot be named by its symbol, rather than report an error, fallback to a structural printout if possible 4998 // hole because there's a hole in node builder flags 4999 WriteTypeArgumentsOfSignature = 1 << 5, // Write the type arguments instead of type parameters of the signature 5000 UseFullyQualifiedType = 1 << 6, // Write out the fully qualified type name (eg. Module.Type, instead of Type) 5001 // hole because `UseOnlyExternalAliasing` is here in node builder flags, but functions which take old flags use `SymbolFormatFlags` instead 5002 SuppressAnyReturnType = 1 << 8, // If the return type is any-like, don't offer a return type. 5003 // hole because `WriteTypeParametersInQualifiedName` is here in node builder flags, but functions which take old flags use `SymbolFormatFlags` for this instead 5004 MultilineObjectLiterals = 1 << 10, // Always print object literals across multiple lines (only used to map into node builder flags) 5005 WriteClassExpressionAsTypeLiteral = 1 << 11, // Write a type literal instead of (Anonymous class) 5006 UseTypeOfFunction = 1 << 12, // Write typeof instead of function type literal 5007 OmitParameterModifiers = 1 << 13, // Omit modifiers on parameters 5008 5009 UseAliasDefinedOutsideCurrentScope = 1 << 14, // For a `type T = ... ` defined in a different file, write `T` instead of its value, even though `T` can't be accessed in the current scope. 5010 UseSingleQuotesForStringLiteralType = 1 << 28, // Use single quotes for string literal type 5011 NoTypeReduction = 1 << 29, // Don't call getReducedType 5012 OmitThisParameter = 1 << 25, 5013 5014 // Error Handling 5015 AllowUniqueESSymbolType = 1 << 20, // This is bit 20 to align with the same bit in `NodeBuilderFlags` 5016 5017 // TypeFormatFlags exclusive 5018 AddUndefined = 1 << 17, // Add undefined to types of initialized, non-optional parameters 5019 WriteArrowStyleSignature = 1 << 18, // Write arrow style signature 5020 5021 // State 5022 InArrayType = 1 << 19, // Writing an array element type 5023 InElementType = 1 << 21, // Writing an array or union element type 5024 InFirstTypeArgument = 1 << 22, // Writing first type argument of the instantiated type 5025 InTypeAlias = 1 << 23, // Writing type in type alias declaration 5026 5027 /** @deprecated */ WriteOwnNameForAnyLike = 0, // Does nothing 5028 5029 NodeBuilderFlagsMask = NoTruncation | WriteArrayAsGenericType | UseStructuralFallback | WriteTypeArgumentsOfSignature | 5030 UseFullyQualifiedType | SuppressAnyReturnType | MultilineObjectLiterals | WriteClassExpressionAsTypeLiteral | 5031 UseTypeOfFunction | OmitParameterModifiers | UseAliasDefinedOutsideCurrentScope | AllowUniqueESSymbolType | InTypeAlias | 5032 UseSingleQuotesForStringLiteralType | NoTypeReduction | OmitThisParameter 5033 } 5034 5035 export const enum SymbolFormatFlags { 5036 None = 0, 5037 5038 // Write symbols's type argument if it is instantiated symbol 5039 // eg. class C<T> { p: T } <-- Show p as C<T>.p here 5040 // var a: C<number>; 5041 // var p = a.p; <--- Here p is property of C<number> so show it as C<number>.p instead of just C.p 5042 WriteTypeParametersOrArguments = 1 << 0, 5043 5044 // Use only external alias information to get the symbol name in the given context 5045 // eg. module m { export class c { } } import x = m.c; 5046 // When this flag is specified m.c will be used to refer to the class instead of alias symbol x 5047 UseOnlyExternalAliasing = 1 << 1, 5048 5049 // Build symbol name using any nodes needed, instead of just components of an entity name 5050 AllowAnyNodeKind = 1 << 2, 5051 5052 // Prefer aliases which are not directly visible 5053 UseAliasDefinedOutsideCurrentScope = 1 << 3, 5054 5055 // { [E.A]: 1 } 5056 /* @internal */ WriteComputedProps = 1 << 4, 5057 5058 // Skip building an accessible symbol chain 5059 /* @internal */ DoNotIncludeSymbolChain = 1 << 5, 5060 } 5061 5062 /* @internal */ 5063 export interface SymbolWalker { 5064 /** Note: Return values are not ordered. */ 5065 walkType(root: Type): { visitedTypes: readonly Type[], visitedSymbols: readonly Symbol[] }; 5066 /** Note: Return values are not ordered. */ 5067 walkSymbol(root: Symbol): { visitedTypes: readonly Type[], visitedSymbols: readonly Symbol[] }; 5068 } 5069 5070 // This was previously deprecated in our public API, but is still used internally 5071 interface SymbolWriter extends SymbolTracker { 5072 writeKeyword(text: string): void; 5073 writeOperator(text: string): void; 5074 writePunctuation(text: string): void; 5075 writeSpace(text: string): void; 5076 writeStringLiteral(text: string): void; 5077 writeParameter(text: string): void; 5078 writeProperty(text: string): void; 5079 writeSymbol(text: string, symbol: Symbol): void; 5080 writeLine(force?: boolean): void; 5081 increaseIndent(): void; 5082 decreaseIndent(): void; 5083 clear(): void; 5084 } 5085 5086 /* @internal */ 5087 export const enum SymbolAccessibility { 5088 Accessible, 5089 NotAccessible, 5090 CannotBeNamed 5091 } 5092 5093 /* @internal */ 5094 export const enum SyntheticSymbolKind { 5095 UnionOrIntersection, 5096 Spread 5097 } 5098 5099 export const enum TypePredicateKind { 5100 This, 5101 Identifier, 5102 AssertsThis, 5103 AssertsIdentifier 5104 } 5105 5106 export interface TypePredicateBase { 5107 kind: TypePredicateKind; 5108 type: Type | undefined; 5109 } 5110 5111 export interface ThisTypePredicate extends TypePredicateBase { 5112 kind: TypePredicateKind.This; 5113 parameterName: undefined; 5114 parameterIndex: undefined; 5115 type: Type; 5116 } 5117 5118 export interface IdentifierTypePredicate extends TypePredicateBase { 5119 kind: TypePredicateKind.Identifier; 5120 parameterName: string; 5121 parameterIndex: number; 5122 type: Type; 5123 } 5124 5125 export interface AssertsThisTypePredicate extends TypePredicateBase { 5126 kind: TypePredicateKind.AssertsThis; 5127 parameterName: undefined; 5128 parameterIndex: undefined; 5129 type: Type | undefined; 5130 } 5131 5132 export interface AssertsIdentifierTypePredicate extends TypePredicateBase { 5133 kind: TypePredicateKind.AssertsIdentifier; 5134 parameterName: string; 5135 parameterIndex: number; 5136 type: Type | undefined; 5137 } 5138 5139 export type TypePredicate = ThisTypePredicate | IdentifierTypePredicate | AssertsThisTypePredicate | AssertsIdentifierTypePredicate; 5140 5141 /* @internal */ 5142 export type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration; 5143 5144 /* @internal */ 5145 export type AnyImportOrRequire = AnyImportSyntax | VariableDeclarationInitializedTo<RequireOrImportCall>; 5146 5147 /* @internal */ 5148 export type AnyImportOrBareOrAccessedRequire = AnyImportSyntax | VariableDeclarationInitializedTo<RequireOrImportCall | AccessExpression>; 5149 5150 /* @internal */ 5151 export type AnyImportOrRequireStatement = AnyImportSyntax | RequireVariableStatement; 5152 5153 /* @internal */ 5154 export type AnyImportOrReExport = AnyImportSyntax | ExportDeclaration; 5155 5156 /* @internal */ 5157 export interface ValidImportTypeNode extends ImportTypeNode { 5158 argument: LiteralTypeNode & { literal: StringLiteral }; 5159 } 5160 5161 /* @internal */ 5162 export type AnyValidImportOrReExport = 5163 | (ImportDeclaration | ExportDeclaration) & { moduleSpecifier: StringLiteral } 5164 | ImportEqualsDeclaration & { moduleReference: ExternalModuleReference & { expression: StringLiteral } } 5165 | RequireOrImportCall 5166 | ValidImportTypeNode; 5167 5168 /* @internal */ 5169 export type RequireOrImportCall = CallExpression & { expression: Identifier, arguments: [StringLiteralLike] }; 5170 5171 /* @internal */ 5172 export interface VariableDeclarationInitializedTo<T extends Expression> extends VariableDeclaration { 5173 readonly initializer: T; 5174 } 5175 5176 /* @internal */ 5177 export interface RequireVariableStatement extends VariableStatement { 5178 readonly declarationList: RequireVariableDeclarationList; 5179 } 5180 5181 /* @internal */ 5182 export interface RequireVariableDeclarationList extends VariableDeclarationList { 5183 readonly declarations: NodeArray<VariableDeclarationInitializedTo<RequireOrImportCall>>; 5184 } 5185 5186 /* @internal */ 5187 export type LateVisibilityPaintedStatement = 5188 | AnyImportSyntax 5189 | VariableStatement 5190 | ClassDeclaration 5191 | FunctionDeclaration 5192 | ModuleDeclaration 5193 | TypeAliasDeclaration 5194 | InterfaceDeclaration 5195 | EnumDeclaration 5196 | StructDeclaration; 5197 5198 /* @internal */ 5199 export interface SymbolVisibilityResult { 5200 accessibility: SymbolAccessibility; 5201 aliasesToMakeVisible?: LateVisibilityPaintedStatement[]; // aliases that need to have this symbol visible 5202 errorSymbolName?: string; // Optional symbol name that results in error 5203 errorNode?: Node; // optional node that results in error 5204 } 5205 5206 /* @internal */ 5207 export interface SymbolAccessibilityResult extends SymbolVisibilityResult { 5208 errorModuleName?: string; // If the symbol is not visible from module, module's name 5209 } 5210 5211 /* @internal */ 5212 export interface AllAccessorDeclarations { 5213 firstAccessor: AccessorDeclaration; 5214 secondAccessor: AccessorDeclaration | undefined; 5215 getAccessor: GetAccessorDeclaration | undefined; 5216 setAccessor: SetAccessorDeclaration | undefined; 5217 } 5218 5219 /* @internal */ 5220 export interface AllDecorators { 5221 decorators: readonly Decorator[] | undefined; 5222 parameters?: readonly (readonly Decorator[] | undefined)[]; 5223 getDecorators?: readonly Decorator[] | undefined; 5224 setDecorators?: readonly Decorator[] | undefined; 5225 } 5226 5227 /** Indicates how to serialize the name for a TypeReferenceNode when emitting decorator metadata */ 5228 /* @internal */ 5229 export enum TypeReferenceSerializationKind { 5230 // The TypeReferenceNode could not be resolved. 5231 // The type name should be emitted using a safe fallback. 5232 Unknown, 5233 5234 // The TypeReferenceNode resolves to a type with a constructor 5235 // function that can be reached at runtime (e.g. a `class` 5236 // declaration or a `var` declaration for the static side 5237 // of a type, such as the global `Promise` type in lib.d.ts). 5238 TypeWithConstructSignatureAndValue, 5239 5240 // The TypeReferenceNode resolves to a Void-like, Nullable, or Never type. 5241 VoidNullableOrNeverType, 5242 5243 // The TypeReferenceNode resolves to a Number-like type. 5244 NumberLikeType, 5245 5246 // The TypeReferenceNode resolves to a BigInt-like type. 5247 BigIntLikeType, 5248 5249 // The TypeReferenceNode resolves to a String-like type. 5250 StringLikeType, 5251 5252 // The TypeReferenceNode resolves to a Boolean-like type. 5253 BooleanType, 5254 5255 // The TypeReferenceNode resolves to an Array-like type. 5256 ArrayLikeType, 5257 5258 // The TypeReferenceNode resolves to the ESSymbol type. 5259 ESSymbolType, 5260 5261 // The TypeReferenceNode resolved to the global Promise constructor symbol. 5262 Promise, 5263 5264 // The TypeReferenceNode resolves to a Function type or a type with call signatures. 5265 TypeWithCallSignature, 5266 5267 // The TypeReferenceNode resolves to any other type. 5268 ObjectType, 5269 } 5270 5271 /* @internal */ 5272 export interface EmitResolver { 5273 hasGlobalName(name: string): boolean; 5274 getReferencedExportContainer(node: Identifier, prefixLocals?: boolean): SourceFile | ModuleDeclaration | EnumDeclaration | undefined; 5275 getReferencedImportDeclaration(node: Identifier): Declaration | undefined; 5276 getReferencedDeclarationWithCollidingName(node: Identifier): Declaration | undefined; 5277 isDeclarationWithCollidingName(node: Declaration): boolean; 5278 isValueAliasDeclaration(node: Node): boolean; 5279 isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean; 5280 isReferenced(node: Node): boolean; 5281 isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; 5282 getNodeCheckFlags(node: Node): NodeCheckFlags; 5283 isDeclarationVisible(node: Declaration | AnyImportSyntax): boolean; 5284 isLateBound(node: Declaration): node is LateBoundDeclaration; 5285 collectLinkedAliases(node: Identifier, setVisibility?: boolean): Node[] | undefined; 5286 isImplementationOfOverload(node: SignatureDeclaration): boolean | undefined; 5287 isRequiredInitializedParameter(node: ParameterDeclaration): boolean; 5288 isOptionalUninitializedParameterProperty(node: ParameterDeclaration): boolean; 5289 isExpandoFunctionDeclaration(node: FunctionDeclaration): boolean; 5290 getPropertiesOfContainerFunction(node: Declaration): Symbol[]; 5291 createTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration | PropertyAccessExpression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker, addUndefined?: boolean): TypeNode | undefined; 5292 createReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode | undefined; 5293 createTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode | undefined; 5294 createLiteralConstValue(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration, tracker: SymbolTracker): Expression; 5295 isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node | undefined, meaning: SymbolFlags | undefined, shouldComputeAliasToMarkVisible: boolean): SymbolAccessibilityResult; 5296 isEntityNameVisible(entityName: EntityNameOrEntityNameExpression, enclosingDeclaration: Node): SymbolVisibilityResult; 5297 // Returns the constant value this property access resolves to, or 'undefined' for a non-constant 5298 getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined; 5299 getReferencedValueDeclaration(reference: Identifier): Declaration | undefined; 5300 getTypeReferenceSerializationKind(typeName: EntityName, location?: Node): TypeReferenceSerializationKind; 5301 isOptionalParameter(node: ParameterDeclaration): boolean; 5302 moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean; 5303 isArgumentsLocalBinding(node: Identifier): boolean; 5304 getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration | ImportTypeNode | ImportCall): SourceFile | undefined; 5305 getTypeReferenceDirectivesForEntityName(name: EntityNameOrEntityNameExpression): [specifier: string, mode: SourceFile["impliedNodeFormat"] | undefined][] | undefined; 5306 getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): [specifier: string, mode: SourceFile["impliedNodeFormat"] | undefined][] | undefined; 5307 isLiteralConstDeclaration(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration): boolean; 5308 getJsxFactoryEntity(location?: Node): EntityName | undefined; 5309 getJsxFragmentFactoryEntity(location?: Node): EntityName | undefined; 5310 getAllAccessorDeclarations(declaration: AccessorDeclaration): AllAccessorDeclarations; 5311 getSymbolOfExternalModuleSpecifier(node: StringLiteralLike): Symbol | undefined; 5312 isBindingCapturedByNode(node: Node, decl: VariableDeclaration | BindingElement): boolean; 5313 getDeclarationStatementsForSourceFile(node: SourceFile, flags: NodeBuilderFlags, tracker: SymbolTracker, bundled?: boolean): Statement[] | undefined; 5314 isImportRequiredByAugmentation(decl: ImportDeclaration): boolean; 5315 } 5316 5317 export const enum SymbolFlags { 5318 None = 0, 5319 FunctionScopedVariable = 1 << 0, // Variable (var) or parameter 5320 BlockScopedVariable = 1 << 1, // A block-scoped variable (let or const) 5321 Property = 1 << 2, // Property or enum member 5322 EnumMember = 1 << 3, // Enum member 5323 Function = 1 << 4, // Function 5324 Class = 1 << 5, // Class 5325 Interface = 1 << 6, // Interface 5326 ConstEnum = 1 << 7, // Const enum 5327 RegularEnum = 1 << 8, // Enum 5328 ValueModule = 1 << 9, // Instantiated module 5329 NamespaceModule = 1 << 10, // Uninstantiated module 5330 TypeLiteral = 1 << 11, // Type Literal or mapped type 5331 ObjectLiteral = 1 << 12, // Object Literal 5332 Method = 1 << 13, // Method 5333 Constructor = 1 << 14, // Constructor 5334 GetAccessor = 1 << 15, // Get accessor 5335 SetAccessor = 1 << 16, // Set accessor 5336 Signature = 1 << 17, // Call, construct, or index signature 5337 TypeParameter = 1 << 18, // Type parameter 5338 TypeAlias = 1 << 19, // Type alias 5339 ExportValue = 1 << 20, // Exported value marker (see comment in declareModuleMember in binder) 5340 Alias = 1 << 21, // An alias for another symbol (see comment in isAliasSymbolDeclaration in checker) 5341 Prototype = 1 << 22, // Prototype property (no source representation) 5342 ExportStar = 1 << 23, // Export * declaration 5343 Optional = 1 << 24, // Optional property 5344 Transient = 1 << 25, // Transient symbol (created during type check) 5345 Assignment = 1 << 26, // Assignment treated as declaration (eg `this.prop = 1`) 5346 ModuleExports = 1 << 27, // Symbol for CommonJS `module` of `module.exports` 5347 /* @internal */ 5348 All = FunctionScopedVariable | BlockScopedVariable | Property | EnumMember | Function | Class | Interface | ConstEnum | RegularEnum | ValueModule | NamespaceModule | TypeLiteral 5349 | ObjectLiteral | Method | Constructor | GetAccessor | SetAccessor | Signature | TypeParameter | TypeAlias | ExportValue | Alias | Prototype | ExportStar | Optional | Transient, 5350 5351 Enum = RegularEnum | ConstEnum, 5352 Variable = FunctionScopedVariable | BlockScopedVariable, 5353 Value = Variable | Property | EnumMember | ObjectLiteral | Function | Class | Enum | ValueModule | Method | GetAccessor | SetAccessor, 5354 Type = Class | Interface | Enum | EnumMember | TypeLiteral | TypeParameter | TypeAlias, 5355 Namespace = ValueModule | NamespaceModule | Enum, 5356 Module = ValueModule | NamespaceModule, 5357 Accessor = GetAccessor | SetAccessor, 5358 5359 // Variables can be redeclared, but can not redeclare a block-scoped declaration with the 5360 // same name, or any other value that is not a variable, e.g. ValueModule or Class 5361 FunctionScopedVariableExcludes = Value & ~FunctionScopedVariable, 5362 5363 // Block-scoped declarations are not allowed to be re-declared 5364 // they can not merge with anything in the value space 5365 BlockScopedVariableExcludes = Value, 5366 5367 ParameterExcludes = Value, 5368 PropertyExcludes = None, 5369 EnumMemberExcludes = Value | Type, 5370 FunctionExcludes = Value & ~(Function | ValueModule | Class), 5371 ClassExcludes = (Value | Type) & ~(ValueModule | Interface | Function), // class-interface mergability done in checker.ts 5372 InterfaceExcludes = Type & ~(Interface | Class), 5373 RegularEnumExcludes = (Value | Type) & ~(RegularEnum | ValueModule), // regular enums merge only with regular enums and modules 5374 ConstEnumExcludes = (Value | Type) & ~ConstEnum, // const enums merge only with const enums 5375 ValueModuleExcludes = Value & ~(Function | Class | RegularEnum | ValueModule), 5376 NamespaceModuleExcludes = 0, 5377 MethodExcludes = Value & ~Method, 5378 GetAccessorExcludes = Value & ~SetAccessor, 5379 SetAccessorExcludes = Value & ~GetAccessor, 5380 AccessorExcludes = Value & ~Accessor, 5381 TypeParameterExcludes = Type & ~TypeParameter, 5382 TypeAliasExcludes = Type, 5383 AliasExcludes = Alias, 5384 5385 ModuleMember = Variable | Function | Class | Interface | Enum | Module | TypeAlias | Alias, 5386 5387 ExportHasLocal = Function | Class | Enum | ValueModule, 5388 5389 BlockScoped = BlockScopedVariable | Class | Enum, 5390 5391 PropertyOrAccessor = Property | Accessor, 5392 5393 ClassMember = Method | Accessor | Property, 5394 5395 /* @internal */ 5396 ExportSupportsDefaultModifier = Class | Function | Interface, 5397 5398 /* @internal */ 5399 ExportDoesNotSupportDefaultModifier = ~ExportSupportsDefaultModifier, 5400 5401 /* @internal */ 5402 // The set of things we consider semantically classifiable. Used to speed up the LS during 5403 // classification. 5404 Classifiable = Class | Enum | TypeAlias | Interface | TypeParameter | Module | Alias, 5405 5406 /* @internal */ 5407 LateBindingContainer = Class | Interface | TypeLiteral | ObjectLiteral | Function, 5408 } 5409 5410 /* @internal */ 5411 export type SymbolId = number; 5412 5413 export interface Symbol { 5414 flags: SymbolFlags; // Symbol flags 5415 escapedName: __String; // Name of symbol 5416 declarations?: Declaration[]; // Declarations associated with this symbol 5417 valueDeclaration?: Declaration; // First value declaration of the symbol 5418 members?: SymbolTable; // Class, interface or object literal instance members 5419 exports?: SymbolTable; // Module exports 5420 globalExports?: SymbolTable; // Conditional global UMD exports 5421 /* @internal */ id?: SymbolId; // Unique id (used to look up SymbolLinks) 5422 /* @internal */ mergeId?: number; // Merge id (used to look up merged symbol) 5423 /* @internal */ parent?: Symbol; // Parent symbol 5424 exportSymbol?: Symbol; // Exported symbol associated with this symbol 5425 /* @internal */ constEnumOnlyModule?: boolean; // True if module contains only const enums or other modules with only const enums 5426 /* @internal */ isReferenced?: SymbolFlags; // True if the symbol is referenced elsewhere. Keeps track of the meaning of a reference in case a symbol is both a type parameter and parameter. 5427 /* @internal */ isReplaceableByMethod?: boolean; // Can this Javascript class property be replaced by a method symbol? 5428 /* @internal */ isAssigned?: boolean; // True if the symbol is a parameter with assignments 5429 /* @internal */ assignmentDeclarationMembers?: ESMap<number, Declaration>; // detected late-bound assignment declarations associated with the symbol 5430 } 5431 5432 /* @internal */ 5433 export interface SymbolLinks { 5434 immediateTarget?: Symbol; // Immediate target of an alias. May be another alias. Do not access directly, use `checker.getImmediateAliasedSymbol` instead. 5435 aliasTarget?: Symbol, // Resolved (non-alias) target of an alias 5436 target?: Symbol; // Original version of an instantiated symbol 5437 type?: Type; // Type of value symbol 5438 writeType?: Type; // Type of value symbol in write contexts 5439 nameType?: Type; // Type associated with a late-bound symbol 5440 uniqueESSymbolType?: Type; // UniqueESSymbol type for a symbol 5441 declaredType?: Type; // Type of class, interface, enum, type alias, or type parameter 5442 typeParameters?: TypeParameter[]; // Type parameters of type alias (undefined if non-generic) 5443 outerTypeParameters?: TypeParameter[]; // Outer type parameters of anonymous object type 5444 instantiations?: ESMap<string, Type>; // Instantiations of generic type alias (undefined if non-generic) 5445 aliasSymbol?: Symbol; // Alias associated with generic type alias instantiation 5446 aliasTypeArguments?: readonly Type[] // Alias type arguments (if any) 5447 inferredClassSymbol?: ESMap<SymbolId, TransientSymbol>; // Symbol of an inferred ES5 constructor function 5448 mapper?: TypeMapper; // Type mapper for instantiation alias 5449 referenced?: boolean; // True if alias symbol has been referenced as a value that can be emitted 5450 constEnumReferenced?: boolean; // True if alias symbol resolves to a const enum and is referenced as a value ('referenced' will be false) 5451 containingType?: UnionOrIntersectionType; // Containing union or intersection type for synthetic property 5452 leftSpread?: Symbol; // Left source for synthetic spread property 5453 rightSpread?: Symbol; // Right source for synthetic spread property 5454 syntheticOrigin?: Symbol; // For a property on a mapped or spread type, points back to the original property 5455 isDiscriminantProperty?: boolean; // True if discriminant synthetic property 5456 resolvedExports?: SymbolTable; // Resolved exports of module or combined early- and late-bound static members of a class. 5457 resolvedMembers?: SymbolTable; // Combined early- and late-bound members of a symbol 5458 exportsChecked?: boolean; // True if exports of external module have been checked 5459 typeParametersChecked?: boolean; // True if type parameters of merged class and interface declarations have been checked. 5460 isDeclarationWithCollidingName?: boolean; // True if symbol is block scoped redeclaration 5461 bindingElement?: BindingElement; // Binding element associated with property symbol 5462 exportsSomeValue?: boolean; // True if module exports some value (not just types) 5463 enumKind?: EnumKind; // Enum declaration classification 5464 originatingImport?: ImportDeclaration | ImportCall; // Import declaration which produced the symbol, present if the symbol is marked as uncallable but had call signatures in `resolveESModuleSymbol` 5465 lateSymbol?: Symbol; // Late-bound symbol for a computed property 5466 specifierCache?: ESMap<string, string>; // For symbols corresponding to external modules, a cache of incoming path -> module specifier name mappings 5467 extendedContainers?: Symbol[]; // Containers (other than the parent) which this symbol is aliased in 5468 extendedContainersByFile?: ESMap<NodeId, Symbol[]>; // Containers (other than the parent) which this symbol is aliased in 5469 variances?: VarianceFlags[]; // Alias symbol type argument variance cache 5470 deferralConstituents?: Type[]; // Calculated list of constituents for a deferred type 5471 deferralWriteConstituents?: Type[]; // Constituents of a deferred `writeType` 5472 deferralParent?: Type; // Source union/intersection of a deferred type 5473 cjsExportMerged?: Symbol; // Version of the symbol with all non export= exports merged with the export= target 5474 typeOnlyDeclaration?: TypeOnlyAliasDeclaration | false; // First resolved alias declaration that makes the symbol only usable in type constructs 5475 isConstructorDeclaredProperty?: boolean; // Property declared through 'this.x = ...' assignment in constructor 5476 tupleLabelDeclaration?: NamedTupleMember | ParameterDeclaration; // Declaration associated with the tuple's label 5477 accessibleChainCache?: ESMap<string, Symbol[] | undefined>; 5478 filteredIndexSymbolCache?: ESMap<string, Symbol> //Symbol with applicable declarations 5479 } 5480 5481 /* @internal */ 5482 export const enum EnumKind { 5483 Numeric, // Numeric enum (each member has a TypeFlags.Enum type) 5484 Literal // Literal enum (each member has a TypeFlags.EnumLiteral type) 5485 } 5486 5487 /* @internal */ 5488 export const enum CheckFlags { 5489 Instantiated = 1 << 0, // Instantiated symbol 5490 SyntheticProperty = 1 << 1, // Property in union or intersection type 5491 SyntheticMethod = 1 << 2, // Method in union or intersection type 5492 Readonly = 1 << 3, // Readonly transient symbol 5493 ReadPartial = 1 << 4, // Synthetic property present in some but not all constituents 5494 WritePartial = 1 << 5, // Synthetic property present in some but only satisfied by an index signature in others 5495 HasNonUniformType = 1 << 6, // Synthetic property with non-uniform type in constituents 5496 HasLiteralType = 1 << 7, // Synthetic property with at least one literal type in constituents 5497 ContainsPublic = 1 << 8, // Synthetic property with public constituent(s) 5498 ContainsProtected = 1 << 9, // Synthetic property with protected constituent(s) 5499 ContainsPrivate = 1 << 10, // Synthetic property with private constituent(s) 5500 ContainsStatic = 1 << 11, // Synthetic property with static constituent(s) 5501 Late = 1 << 12, // Late-bound symbol for a computed property with a dynamic name 5502 ReverseMapped = 1 << 13, // Property of reverse-inferred homomorphic mapped type 5503 OptionalParameter = 1 << 14, // Optional parameter 5504 RestParameter = 1 << 15, // Rest parameter 5505 DeferredType = 1 << 16, // Calculation of the type of this symbol is deferred due to processing costs, should be fetched with `getTypeOfSymbolWithDeferredType` 5506 HasNeverType = 1 << 17, // Synthetic property with at least one never type in constituents 5507 Mapped = 1 << 18, // Property of mapped type 5508 StripOptional = 1 << 19, // Strip optionality in mapped property 5509 Unresolved = 1 << 20, // Unresolved type alias symbol 5510 Synthetic = SyntheticProperty | SyntheticMethod, 5511 Discriminant = HasNonUniformType | HasLiteralType, 5512 Partial = ReadPartial | WritePartial 5513 } 5514 5515 /* @internal */ 5516 export interface TransientSymbol extends Symbol, SymbolLinks { 5517 checkFlags: CheckFlags; 5518 } 5519 5520 /* @internal */ 5521 export interface MappedSymbol extends TransientSymbol { 5522 mappedType: MappedType; 5523 keyType: Type; 5524 } 5525 5526 /* @internal */ 5527 export interface ReverseMappedSymbol extends TransientSymbol { 5528 propertyType: Type; 5529 mappedType: MappedType; 5530 constraintType: IndexType; 5531 } 5532 5533 export const enum InternalSymbolName { 5534 Call = "__call", // Call signatures 5535 Constructor = "__constructor", // Constructor implementations 5536 New = "__new", // Constructor signatures 5537 Index = "__index", // Index signatures 5538 ExportStar = "__export", // Module export * declarations 5539 Global = "__global", // Global self-reference 5540 Missing = "__missing", // Indicates missing symbol 5541 Type = "__type", // Anonymous type literal symbol 5542 Object = "__object", // Anonymous object literal declaration 5543 JSXAttributes = "__jsxAttributes", // Anonymous JSX attributes object literal declaration 5544 Class = "__class", // Unnamed class expression 5545 Function = "__function", // Unnamed function expression 5546 Computed = "__computed", // Computed property name declaration with dynamic name 5547 Resolving = "__resolving__", // Indicator symbol used to mark partially resolved type aliases 5548 ExportEquals = "export=", // Export assignment symbol 5549 Default = "default", // Default export symbol (technically not wholly internal, but included here for usability) 5550 This = "this", 5551 } 5552 5553 /** 5554 * This represents a string whose leading underscore have been escaped by adding extra leading underscores. 5555 * The shape of this brand is rather unique compared to others we've used. 5556 * Instead of just an intersection of a string and an object, it is that union-ed 5557 * with an intersection of void and an object. This makes it wholly incompatible 5558 * with a normal string (which is good, it cannot be misused on assignment or on usage), 5559 * while still being comparable with a normal string via === (also good) and castable from a string. 5560 */ 5561 export type __String = (string & { __escapedIdentifier: void }) | (void & { __escapedIdentifier: void }) | InternalSymbolName; // eslint-disable-line @typescript-eslint/naming-convention 5562 5563 /** ReadonlyMap where keys are `__String`s. */ 5564 export interface ReadonlyUnderscoreEscapedMap<T> extends ReadonlyESMap<__String, T> { 5565 } 5566 5567 /** Map where keys are `__String`s. */ 5568 export interface UnderscoreEscapedMap<T> extends ESMap<__String, T>, ReadonlyUnderscoreEscapedMap<T> { 5569 } 5570 5571 /** SymbolTable based on ES6 Map interface. */ 5572 export type SymbolTable = UnderscoreEscapedMap<Symbol>; 5573 5574 /** Used to track a `declare module "foo*"`-like declaration. */ 5575 /* @internal */ 5576 export interface PatternAmbientModule { 5577 pattern: Pattern; 5578 symbol: Symbol; 5579 } 5580 5581 /* @internal */ 5582 export const enum NodeCheckFlags { 5583 TypeChecked = 0x00000001, // Node has been type checked 5584 LexicalThis = 0x00000002, // Lexical 'this' reference 5585 CaptureThis = 0x00000004, // Lexical 'this' used in body 5586 CaptureNewTarget = 0x00000008, // Lexical 'new.target' used in body 5587 SuperInstance = 0x00000100, // Instance 'super' reference 5588 SuperStatic = 0x00000200, // Static 'super' reference 5589 ContextChecked = 0x00000400, // Contextual types have been assigned 5590 MethodWithSuperPropertyAccessInAsync = 0x00000800, // A method that contains a SuperProperty access in an async context. 5591 MethodWithSuperPropertyAssignmentInAsync = 0x00001000, // A method that contains a SuperProperty assignment in an async context. 5592 CaptureArguments = 0x00002000, // Lexical 'arguments' used in body 5593 EnumValuesComputed = 0x00004000, // Values for enum members have been computed, and any errors have been reported for them. 5594 LexicalModuleMergesWithClass = 0x00008000, // Instantiated lexical module declaration is merged with a previous class declaration. 5595 LoopWithCapturedBlockScopedBinding = 0x00010000, // Loop that contains block scoped variable captured in closure 5596 ContainsCapturedBlockScopeBinding = 0x00020000, // Part of a loop that contains block scoped variable captured in closure 5597 CapturedBlockScopedBinding = 0x00040000, // Block-scoped binding that is captured in some function 5598 BlockScopedBindingInLoop = 0x00080000, // Block-scoped binding with declaration nested inside iteration statement 5599 ClassWithBodyScopedClassBinding = 0x00100000, // Decorated class that contains a binding to itself inside of the class body. 5600 BodyScopedClassBinding = 0x00200000, // Binding to a decorated class inside of the class's body. 5601 NeedsLoopOutParameter = 0x00400000, // Block scoped binding whose value should be explicitly copied outside of the converted loop 5602 AssignmentsMarked = 0x00800000, // Parameter assignments have been marked 5603 ClassWithConstructorReference = 0x01000000, // Class that contains a binding to its constructor inside of the class body. 5604 ConstructorReferenceInClass = 0x02000000, // Binding to a class constructor inside of the class's body. 5605 ContainsClassWithPrivateIdentifiers = 0x04000000, // Marked on all block-scoped containers containing a class with private identifiers. 5606 ContainsSuperPropertyInStaticInitializer = 0x08000000, // Marked on all block-scoped containers containing a static initializer with 'super.x' or 'super[x]'. 5607 InCheckIdentifier = 0x10000000, 5608 } 5609 5610 /* @internal */ 5611 export interface NodeLinks { 5612 flags: NodeCheckFlags; // Set of flags specific to Node 5613 resolvedType?: Type; // Cached type of type node 5614 resolvedEnumType?: Type; // Cached constraint type from enum jsdoc tag 5615 resolvedSignature?: Signature; // Cached signature of signature node or call expression 5616 resolvedSymbol?: Symbol; // Cached name resolution result 5617 resolvedIndexInfo?: IndexInfo; // Cached indexing info resolution result 5618 effectsSignature?: Signature; // Signature with possible control flow effects 5619 enumMemberValue?: string | number; // Constant value of enum member 5620 isVisible?: boolean; // Is this node visible 5621 containsArgumentsReference?: boolean; // Whether a function-like declaration contains an 'arguments' reference 5622 hasReportedStatementInAmbientContext?: boolean; // Cache boolean if we report statements in ambient context 5623 jsxFlags: JsxFlags; // flags for knowing what kind of element/attributes we're dealing with 5624 resolvedJsxElementAttributesType?: Type; // resolved element attributes type of a JSX openinglike element 5625 resolvedJsxElementAllAttributesType?: Type; // resolved all element attributes type of a JSX openinglike element 5626 resolvedJSDocType?: Type; // Resolved type of a JSDoc type reference 5627 switchTypes?: Type[]; // Cached array of switch case expression types 5628 jsxNamespace?: Symbol | false; // Resolved jsx namespace symbol for this node 5629 jsxImplicitImportContainer?: Symbol | false; // Resolved module symbol the implicit jsx import of this file should refer to 5630 contextFreeType?: Type; // Cached context-free type used by the first pass of inference; used when a function's return is partially contextually sensitive 5631 deferredNodes?: Set<Node>; // Set of nodes whose checking has been deferred 5632 capturedBlockScopeBindings?: Symbol[]; // Block-scoped bindings captured beneath this part of an IterationStatement 5633 outerTypeParameters?: TypeParameter[]; // Outer type parameters of anonymous object type 5634 isExhaustive?: boolean | 0; // Is node an exhaustive switch statement (0 indicates in-process resolution) 5635 skipDirectInference?: true; // Flag set by the API `getContextualType` call on a node when `Completions` is passed to force the checker to skip making inferences to a node's type 5636 declarationRequiresScopeChange?: boolean; // Set by `useOuterVariableScopeInParameter` in checker when downlevel emit would change the name resolution scope inside of a parameter. 5637 serializedTypes?: ESMap<string, TypeNode & {truncating?: boolean, addedLength: number}>; // Collection of types serialized at this location 5638 } 5639 5640 export const enum TypeFlags { 5641 Any = 1 << 0, 5642 Unknown = 1 << 1, 5643 String = 1 << 2, 5644 Number = 1 << 3, 5645 Boolean = 1 << 4, 5646 Enum = 1 << 5, 5647 BigInt = 1 << 6, 5648 StringLiteral = 1 << 7, 5649 NumberLiteral = 1 << 8, 5650 BooleanLiteral = 1 << 9, 5651 EnumLiteral = 1 << 10, // Always combined with StringLiteral, NumberLiteral, or Union 5652 BigIntLiteral = 1 << 11, 5653 ESSymbol = 1 << 12, // Type of symbol primitive introduced in ES6 5654 UniqueESSymbol = 1 << 13, // unique symbol 5655 Void = 1 << 14, 5656 Undefined = 1 << 15, 5657 Null = 1 << 16, 5658 Never = 1 << 17, // Never type 5659 TypeParameter = 1 << 18, // Type parameter 5660 Object = 1 << 19, // Object type 5661 Union = 1 << 20, // Union (T | U) 5662 Intersection = 1 << 21, // Intersection (T & U) 5663 Index = 1 << 22, // keyof T 5664 IndexedAccess = 1 << 23, // T[K] 5665 Conditional = 1 << 24, // T extends U ? X : Y 5666 Substitution = 1 << 25, // Type parameter substitution 5667 NonPrimitive = 1 << 26, // intrinsic object type 5668 TemplateLiteral = 1 << 27, // Template literal type 5669 StringMapping = 1 << 28, // Uppercase/Lowercase type 5670 5671 /* @internal */ 5672 AnyOrUnknown = Any | Unknown, 5673 /* @internal */ 5674 Nullable = Undefined | Null, 5675 Literal = StringLiteral | NumberLiteral | BigIntLiteral | BooleanLiteral, 5676 Unit = Literal | UniqueESSymbol | Nullable, 5677 StringOrNumberLiteral = StringLiteral | NumberLiteral, 5678 /* @internal */ 5679 StringOrNumberLiteralOrUnique = StringLiteral | NumberLiteral | UniqueESSymbol, 5680 /* @internal */ 5681 DefinitelyFalsy = StringLiteral | NumberLiteral | BigIntLiteral | BooleanLiteral | Void | Undefined | Null, 5682 PossiblyFalsy = DefinitelyFalsy | String | Number | BigInt | Boolean, 5683 /* @internal */ 5684 Intrinsic = Any | Unknown | String | Number | BigInt | Boolean | BooleanLiteral | ESSymbol | Void | Undefined | Null | Never | NonPrimitive, 5685 /* @internal */ 5686 Primitive = String | Number | BigInt | Boolean | Enum | EnumLiteral | ESSymbol | Void | Undefined | Null | Literal | UniqueESSymbol, 5687 StringLike = String | StringLiteral | TemplateLiteral | StringMapping, 5688 NumberLike = Number | NumberLiteral | Enum, 5689 BigIntLike = BigInt | BigIntLiteral, 5690 BooleanLike = Boolean | BooleanLiteral, 5691 EnumLike = Enum | EnumLiteral, 5692 ESSymbolLike = ESSymbol | UniqueESSymbol, 5693 VoidLike = Void | Undefined, 5694 /* @internal */ 5695 DefinitelyNonNullable = StringLike | NumberLike | BigIntLike | BooleanLike | EnumLike | ESSymbolLike | Object | NonPrimitive, 5696 /* @internal */ 5697 DisjointDomains = NonPrimitive | StringLike | NumberLike | BigIntLike | BooleanLike | ESSymbolLike | VoidLike | Null, 5698 UnionOrIntersection = Union | Intersection, 5699 StructuredType = Object | Union | Intersection, 5700 TypeVariable = TypeParameter | IndexedAccess, 5701 InstantiableNonPrimitive = TypeVariable | Conditional | Substitution, 5702 InstantiablePrimitive = Index | TemplateLiteral | StringMapping, 5703 Instantiable = InstantiableNonPrimitive | InstantiablePrimitive, 5704 StructuredOrInstantiable = StructuredType | Instantiable, 5705 /* @internal */ 5706 ObjectFlagsType = Any | Nullable | Never | Object | Union | Intersection, 5707 /* @internal */ 5708 Simplifiable = IndexedAccess | Conditional, 5709 /* @internal */ 5710 Singleton = Any | Unknown | String | Number | Boolean | BigInt | ESSymbol | Void | Undefined | Null | Never | NonPrimitive, 5711 // 'Narrowable' types are types where narrowing actually narrows. 5712 // This *should* be every type other than null, undefined, void, and never 5713 Narrowable = Any | Unknown | StructuredOrInstantiable | StringLike | NumberLike | BigIntLike | BooleanLike | ESSymbol | UniqueESSymbol | NonPrimitive, 5714 // The following flags are aggregated during union and intersection type construction 5715 /* @internal */ 5716 IncludesMask = Any | Unknown | Primitive | Never | Object | Union | Intersection | NonPrimitive | TemplateLiteral, 5717 // The following flags are used for different purposes during union and intersection type construction 5718 /* @internal */ 5719 IncludesMissingType = TypeParameter, 5720 /* @internal */ 5721 IncludesNonWideningType = Index, 5722 /* @internal */ 5723 IncludesWildcard = IndexedAccess, 5724 /* @internal */ 5725 IncludesEmptyObject = Conditional, 5726 /* @internal */ 5727 IncludesInstantiable = Substitution, 5728 /* @internal */ 5729 NotPrimitiveUnion = Any | Unknown | Enum | Void | Never | Object | Intersection | IncludesInstantiable, 5730 } 5731 5732 export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; 5733 5734 /* @internal */ 5735 export type TypeId = number; 5736 5737 // Properties common to all types 5738 export interface Type { 5739 flags: TypeFlags; // Flags 5740 /* @internal */ id: TypeId; // Unique ID 5741 /* @internal */ checker: TypeChecker; 5742 symbol: Symbol; // Symbol associated with type (if any) 5743 pattern?: DestructuringPattern; // Destructuring pattern represented by type (if any) 5744 aliasSymbol?: Symbol; // Alias associated with type 5745 aliasTypeArguments?: readonly Type[]; // Alias type arguments (if any) 5746 /* @internal */ 5747 permissiveInstantiation?: Type; // Instantiation with type parameters mapped to wildcard type 5748 /* @internal */ 5749 restrictiveInstantiation?: Type; // Instantiation with type parameters mapped to unconstrained form 5750 /* @internal */ 5751 uniqueLiteralFilledInstantiation?: Type; // Instantiation with type parameters mapped to never type 5752 /* @internal */ 5753 immediateBaseConstraint?: Type; // Immediate base constraint cache 5754 /* @internal */ 5755 widened?: Type; // Cached widened form of the type 5756 } 5757 5758 /* @internal */ 5759 // Intrinsic types (TypeFlags.Intrinsic) 5760 export interface IntrinsicType extends Type { 5761 intrinsicName: string; // Name of intrinsic type 5762 objectFlags: ObjectFlags; 5763 } 5764 5765 /* @internal */ 5766 export interface NullableType extends IntrinsicType { 5767 objectFlags: ObjectFlags; 5768 } 5769 5770 /* @internal */ 5771 export interface FreshableIntrinsicType extends IntrinsicType { 5772 freshType: IntrinsicType; // Fresh version of type 5773 regularType: IntrinsicType; // Regular version of type 5774 } 5775 5776 /* @internal */ 5777 export type FreshableType = LiteralType | FreshableIntrinsicType; 5778 5779 // String literal types (TypeFlags.StringLiteral) 5780 // Numeric literal types (TypeFlags.NumberLiteral) 5781 // BigInt literal types (TypeFlags.BigIntLiteral) 5782 export interface LiteralType extends Type { 5783 value: string | number | PseudoBigInt; // Value of literal 5784 freshType: LiteralType; // Fresh version of type 5785 regularType: LiteralType; // Regular version of type 5786 } 5787 5788 // Unique symbol types (TypeFlags.UniqueESSymbol) 5789 export interface UniqueESSymbolType extends Type { 5790 symbol: Symbol; 5791 escapedName: __String; 5792 } 5793 5794 export interface StringLiteralType extends LiteralType { 5795 value: string; 5796 } 5797 5798 export interface NumberLiteralType extends LiteralType { 5799 value: number; 5800 } 5801 5802 export interface BigIntLiteralType extends LiteralType { 5803 value: PseudoBigInt; 5804 } 5805 5806 // Enum types (TypeFlags.Enum) 5807 export interface EnumType extends Type { 5808 } 5809 5810 // Types included in TypeFlags.ObjectFlagsType have an objectFlags property. Some ObjectFlags 5811 // are specific to certain types and reuse the same bit position. Those ObjectFlags require a check 5812 // for a certain TypeFlags value to determine their meaning. 5813 export const enum ObjectFlags { 5814 Class = 1 << 0, // Class 5815 Interface = 1 << 1, // Interface 5816 Reference = 1 << 2, // Generic type reference 5817 Tuple = 1 << 3, // Synthesized generic tuple type 5818 Anonymous = 1 << 4, // Anonymous 5819 Mapped = 1 << 5, // Mapped 5820 Instantiated = 1 << 6, // Instantiated anonymous or mapped type 5821 ObjectLiteral = 1 << 7, // Originates in an object literal 5822 EvolvingArray = 1 << 8, // Evolving array type 5823 ObjectLiteralPatternWithComputedProperties = 1 << 9, // Object literal pattern with computed properties 5824 ReverseMapped = 1 << 10, // Object contains a property from a reverse-mapped type 5825 JsxAttributes = 1 << 11, // Jsx attributes type 5826 JSLiteral = 1 << 12, // Object type declared in JS - disables errors on read/write of nonexisting members 5827 FreshLiteral = 1 << 13, // Fresh object literal 5828 ArrayLiteral = 1 << 14, // Originates in an array literal 5829 /* @internal */ 5830 PrimitiveUnion = 1 << 15, // Union of only primitive types 5831 /* @internal */ 5832 ContainsWideningType = 1 << 16, // Type is or contains undefined or null widening type 5833 /* @internal */ 5834 ContainsObjectOrArrayLiteral = 1 << 17, // Type is or contains object literal type 5835 /* @internal */ 5836 NonInferrableType = 1 << 18, // Type is or contains anyFunctionType or silentNeverType 5837 /* @internal */ 5838 CouldContainTypeVariablesComputed = 1 << 19, // CouldContainTypeVariables flag has been computed 5839 /* @internal */ 5840 CouldContainTypeVariables = 1 << 20, // Type could contain a type variable 5841 5842 ClassOrInterface = Class | Interface, 5843 /* @internal */ 5844 RequiresWidening = ContainsWideningType | ContainsObjectOrArrayLiteral, 5845 /* @internal */ 5846 PropagatingFlags = ContainsWideningType | ContainsObjectOrArrayLiteral | NonInferrableType, 5847 // Object flags that uniquely identify the kind of ObjectType 5848 /* @internal */ 5849 ObjectTypeKindMask = ClassOrInterface | Reference | Tuple | Anonymous | Mapped | ReverseMapped | EvolvingArray, 5850 5851 // Flags that require TypeFlags.Object 5852 ContainsSpread = 1 << 21, // Object literal contains spread operation 5853 ObjectRestType = 1 << 22, // Originates in object rest declaration 5854 InstantiationExpressionType = 1 << 23, // Originates in instantiation expression 5855 /* @internal */ 5856 IsClassInstanceClone = 1 << 24, // Type is a clone of a class instance type 5857 // Flags that require TypeFlags.Object and ObjectFlags.Reference 5858 /* @internal */ 5859 IdenticalBaseTypeCalculated = 1 << 25, // has had `getSingleBaseForNonAugmentingSubtype` invoked on it already 5860 /* @internal */ 5861 IdenticalBaseTypeExists = 1 << 26, // has a defined cachedEquivalentBaseType member 5862 5863 // Flags that require TypeFlags.UnionOrIntersection or TypeFlags.Substitution 5864 /* @internal */ 5865 IsGenericTypeComputed = 1 << 21, // IsGenericObjectType flag has been computed 5866 /* @internal */ 5867 IsGenericObjectType = 1 << 22, // Union or intersection contains generic object type 5868 /* @internal */ 5869 IsGenericIndexType = 1 << 23, // Union or intersection contains generic index type 5870 /* @internal */ 5871 IsGenericType = IsGenericObjectType | IsGenericIndexType, 5872 5873 // Flags that require TypeFlags.Union 5874 /* @internal */ 5875 ContainsIntersections = 1 << 24, // Union contains intersections 5876 /* @internal */ 5877 IsUnknownLikeUnionComputed = 1 << 25, // IsUnknownLikeUnion flag has been computed 5878 /* @internal */ 5879 IsUnknownLikeUnion = 1 << 26, // Union of null, undefined, and empty object type 5880 /* @internal */ 5881 5882 // Flags that require TypeFlags.Intersection 5883 /* @internal */ 5884 IsNeverIntersectionComputed = 1 << 24, // IsNeverLike flag has been computed 5885 /* @internal */ 5886 IsNeverIntersection = 1 << 25, // Intersection reduces to never 5887 } 5888 5889 /* @internal */ 5890 export type ObjectFlagsType = NullableType | ObjectType | UnionType | IntersectionType; 5891 5892 // Object types (TypeFlags.ObjectType) 5893 export interface ObjectType extends Type { 5894 objectFlags: ObjectFlags; 5895 /* @internal */ members?: SymbolTable; // Properties by name 5896 /* @internal */ properties?: Symbol[]; // Properties 5897 /* @internal */ callSignatures?: readonly Signature[]; // Call signatures of type 5898 /* @internal */ constructSignatures?: readonly Signature[]; // Construct signatures of type 5899 /* @internal */ indexInfos?: readonly IndexInfo[]; // Index signatures 5900 /* @internal */ objectTypeWithoutAbstractConstructSignatures?: ObjectType; 5901 } 5902 5903 /** Class and interface types (ObjectFlags.Class and ObjectFlags.Interface). */ 5904 export interface InterfaceType extends ObjectType { 5905 typeParameters: TypeParameter[] | undefined; // Type parameters (undefined if non-generic) 5906 outerTypeParameters: TypeParameter[] | undefined; // Outer type parameters (undefined if none) 5907 localTypeParameters: TypeParameter[] | undefined; // Local type parameters (undefined if none) 5908 thisType: TypeParameter | undefined; // The "this" type (undefined if none) 5909 /* @internal */ 5910 resolvedBaseConstructorType?: Type; // Resolved base constructor type of class 5911 /* @internal */ 5912 resolvedBaseTypes: BaseType[]; // Resolved base types 5913 /* @internal */ 5914 baseTypesResolved?: boolean; 5915 } 5916 5917 // Object type or intersection of object types 5918 export type BaseType = ObjectType | IntersectionType | TypeVariable; // Also `any` and `object` 5919 5920 export interface InterfaceTypeWithDeclaredMembers extends InterfaceType { 5921 declaredProperties: Symbol[]; // Declared members 5922 declaredCallSignatures: Signature[]; // Declared call signatures 5923 declaredConstructSignatures: Signature[]; // Declared construct signatures 5924 declaredIndexInfos: IndexInfo[]; // Declared index signatures 5925 } 5926 5927 /** 5928 * Type references (ObjectFlags.Reference). When a class or interface has type parameters or 5929 * a "this" type, references to the class or interface are made using type references. The 5930 * typeArguments property specifies the types to substitute for the type parameters of the 5931 * class or interface and optionally includes an extra element that specifies the type to 5932 * substitute for "this" in the resulting instantiation. When no extra argument is present, 5933 * the type reference itself is substituted for "this". The typeArguments property is undefined 5934 * if the class or interface has no type parameters and the reference isn't specifying an 5935 * explicit "this" argument. 5936 */ 5937 export interface TypeReference extends ObjectType { 5938 target: GenericType; // Type reference target 5939 node?: TypeReferenceNode | ArrayTypeNode | TupleTypeNode; 5940 /* @internal */ 5941 mapper?: TypeMapper; 5942 /* @internal */ 5943 resolvedTypeArguments?: readonly Type[]; // Resolved type reference type arguments 5944 /* @internal */ 5945 literalType?: TypeReference; // Clone of type with ObjectFlags.ArrayLiteral set 5946 /* @internal */ 5947 cachedEquivalentBaseType?: Type; // Only set on references to class or interfaces with a single base type and no augmentations 5948 } 5949 5950 export interface DeferredTypeReference extends TypeReference { 5951 /* @internal */ 5952 node: TypeReferenceNode | ArrayTypeNode | TupleTypeNode; 5953 /* @internal */ 5954 mapper?: TypeMapper; 5955 /* @internal */ 5956 instantiations?: ESMap<string, Type>; // Instantiations of generic type alias (undefined if non-generic) 5957 } 5958 5959 /* @internal */ 5960 export const enum VarianceFlags { 5961 Invariant = 0, // Neither covariant nor contravariant 5962 Covariant = 1 << 0, // Covariant 5963 Contravariant = 1 << 1, // Contravariant 5964 Bivariant = Covariant | Contravariant, // Both covariant and contravariant 5965 Independent = 1 << 2, // Unwitnessed type parameter 5966 VarianceMask = Invariant | Covariant | Contravariant | Independent, // Mask containing all measured variances without the unmeasurable flag 5967 Unmeasurable = 1 << 3, // Variance result is unusable - relationship relies on structural comparisons which are not reflected in generic relationships 5968 Unreliable = 1 << 4, // Variance result is unreliable - checking may produce false negatives, but not false positives 5969 AllowsStructuralFallback = Unmeasurable | Unreliable, 5970 } 5971 5972 // Generic class and interface types 5973 export interface GenericType extends InterfaceType, TypeReference { 5974 /* @internal */ 5975 instantiations: ESMap<string, TypeReference>; // Generic instantiation cache 5976 /* @internal */ 5977 variances?: VarianceFlags[]; // Variance of each type parameter 5978 } 5979 5980 export const enum ElementFlags { 5981 Required = 1 << 0, // T 5982 Optional = 1 << 1, // T? 5983 Rest = 1 << 2, // ...T[] 5984 Variadic = 1 << 3, // ...T 5985 Fixed = Required | Optional, 5986 Variable = Rest | Variadic, 5987 NonRequired = Optional | Rest | Variadic, 5988 NonRest = Required | Optional | Variadic, 5989 } 5990 5991 export interface TupleType extends GenericType { 5992 elementFlags: readonly ElementFlags[]; 5993 minLength: number; // Number of required or variadic elements 5994 fixedLength: number; // Number of initial required or optional elements 5995 hasRestElement: boolean; // True if tuple has any rest or variadic elements 5996 combinedFlags: ElementFlags; 5997 readonly: boolean; 5998 labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[]; 5999 } 6000 6001 export interface TupleTypeReference extends TypeReference { 6002 target: TupleType; 6003 } 6004 6005 export interface UnionOrIntersectionType extends Type { 6006 types: Type[]; // Constituent types 6007 /* @internal */ 6008 objectFlags: ObjectFlags; 6009 /* @internal */ 6010 propertyCache?: SymbolTable; // Cache of resolved properties 6011 /* @internal */ 6012 propertyCacheWithoutObjectFunctionPropertyAugment?: SymbolTable; // Cache of resolved properties that does not augment function or object type properties 6013 /* @internal */ 6014 resolvedProperties: Symbol[]; 6015 /* @internal */ 6016 resolvedIndexType: IndexType; 6017 /* @internal */ 6018 resolvedStringIndexType: IndexType; 6019 /* @internal */ 6020 resolvedBaseConstraint: Type; 6021 } 6022 6023 export interface UnionType extends UnionOrIntersectionType { 6024 /* @internal */ 6025 resolvedReducedType?: Type; 6026 /* @internal */ 6027 regularType?: UnionType; 6028 /* @internal */ 6029 origin?: Type; // Denormalized union, intersection, or index type in which union originates 6030 /* @internal */ 6031 keyPropertyName?: __String; // Property with unique unit type that exists in every object/intersection in union type 6032 /* @internal */ 6033 constituentMap?: ESMap<TypeId, Type>; // Constituents keyed by unit type discriminants 6034 } 6035 6036 export interface IntersectionType extends UnionOrIntersectionType { 6037 /* @internal */ 6038 resolvedApparentType: Type; 6039 } 6040 6041 export type StructuredType = ObjectType | UnionType | IntersectionType; 6042 6043 /* @internal */ 6044 // An instantiated anonymous type has a target and a mapper 6045 export interface AnonymousType extends ObjectType { 6046 target?: AnonymousType; // Instantiation target 6047 mapper?: TypeMapper; // Instantiation mapper 6048 instantiations?: ESMap<string, Type>; // Instantiations of generic type alias (undefined if non-generic) 6049 } 6050 6051 /* @internal */ 6052 export interface InstantiationExpressionType extends AnonymousType { 6053 node: ExpressionWithTypeArguments | TypeQueryNode; 6054 } 6055 6056 /* @internal */ 6057 export interface MappedType extends AnonymousType { 6058 declaration: MappedTypeNode; 6059 typeParameter?: TypeParameter; 6060 constraintType?: Type; 6061 nameType?: Type; 6062 templateType?: Type; 6063 modifiersType?: Type; 6064 resolvedApparentType?: Type; 6065 containsError?: boolean; 6066 } 6067 6068 export interface EvolvingArrayType extends ObjectType { 6069 elementType: Type; // Element expressions of evolving array type 6070 finalArrayType?: Type; // Final array type of evolving array type 6071 } 6072 6073 /* @internal */ 6074 export interface ReverseMappedType extends ObjectType { 6075 source: Type; 6076 mappedType: MappedType; 6077 constraintType: IndexType; 6078 } 6079 6080 /* @internal */ 6081 // Resolved object, union, or intersection type 6082 export interface ResolvedType extends ObjectType, UnionOrIntersectionType { 6083 members: SymbolTable; // Properties by name 6084 properties: Symbol[]; // Properties 6085 callSignatures: readonly Signature[]; // Call signatures of type 6086 constructSignatures: readonly Signature[]; // Construct signatures of type 6087 indexInfos: readonly IndexInfo[]; // Index signatures 6088 } 6089 6090 /* @internal */ 6091 // Object literals are initially marked fresh. Freshness disappears following an assignment, 6092 // before a type assertion, or when an object literal's type is widened. The regular 6093 // version of a fresh type is identical except for the TypeFlags.FreshObjectLiteral flag. 6094 export interface FreshObjectLiteralType extends ResolvedType { 6095 regularType: ResolvedType; // Regular version of fresh type 6096 } 6097 6098 /* @internal */ 6099 export interface IterationTypes { 6100 readonly yieldType: Type; 6101 readonly returnType: Type; 6102 readonly nextType: Type; 6103 } 6104 6105 // Just a place to cache element types of iterables and iterators 6106 /* @internal */ 6107 export interface IterableOrIteratorType extends ObjectType, UnionType { 6108 iterationTypesOfGeneratorReturnType?: IterationTypes; 6109 iterationTypesOfAsyncGeneratorReturnType?: IterationTypes; 6110 iterationTypesOfIterable?: IterationTypes; 6111 iterationTypesOfIterator?: IterationTypes; 6112 iterationTypesOfAsyncIterable?: IterationTypes; 6113 iterationTypesOfAsyncIterator?: IterationTypes; 6114 iterationTypesOfIteratorResult?: IterationTypes; 6115 } 6116 6117 /* @internal */ 6118 export interface PromiseOrAwaitableType extends ObjectType, UnionType { 6119 promiseTypeOfPromiseConstructor?: Type; 6120 promisedTypeOfPromise?: Type; 6121 awaitedTypeOfType?: Type; 6122 } 6123 6124 /* @internal */ 6125 export interface SyntheticDefaultModuleType extends Type { 6126 syntheticType?: Type; 6127 defaultOnlyType?: Type; 6128 } 6129 6130 export interface InstantiableType extends Type { 6131 /* @internal */ 6132 resolvedBaseConstraint?: Type; 6133 /* @internal */ 6134 resolvedIndexType?: IndexType; 6135 /* @internal */ 6136 resolvedStringIndexType?: IndexType; 6137 } 6138 6139 // Type parameters (TypeFlags.TypeParameter) 6140 export interface TypeParameter extends InstantiableType { 6141 /** Retrieve using getConstraintFromTypeParameter */ 6142 /* @internal */ 6143 constraint?: Type; // Constraint 6144 /* @internal */ 6145 default?: Type; 6146 /* @internal */ 6147 target?: TypeParameter; // Instantiation target 6148 /* @internal */ 6149 mapper?: TypeMapper; // Instantiation mapper 6150 /* @internal */ 6151 isThisType?: boolean; 6152 /* @internal */ 6153 resolvedDefaultType?: Type; 6154 } 6155 6156 /* @internal */ 6157 export const enum AccessFlags { 6158 None = 0, 6159 IncludeUndefined = 1 << 0, 6160 NoIndexSignatures = 1 << 1, 6161 Writing = 1 << 2, 6162 CacheSymbol = 1 << 3, 6163 NoTupleBoundsCheck = 1 << 4, 6164 ExpressionPosition = 1 << 5, 6165 ReportDeprecated = 1 << 6, 6166 SuppressNoImplicitAnyError = 1 << 7, 6167 Contextual = 1 << 8, 6168 Persistent = IncludeUndefined, 6169 } 6170 6171 // Indexed access types (TypeFlags.IndexedAccess) 6172 // Possible forms are T[xxx], xxx[T], or xxx[keyof T], where T is a type variable 6173 export interface IndexedAccessType extends InstantiableType { 6174 objectType: Type; 6175 indexType: Type; 6176 /* @internal */ 6177 accessFlags: AccessFlags; // Only includes AccessFlags.Persistent 6178 constraint?: Type; 6179 simplifiedForReading?: Type; 6180 simplifiedForWriting?: Type; 6181 } 6182 6183 export type TypeVariable = TypeParameter | IndexedAccessType; 6184 6185 // keyof T types (TypeFlags.Index) 6186 export interface IndexType extends InstantiableType { 6187 type: InstantiableType | UnionOrIntersectionType; 6188 /* @internal */ 6189 stringsOnly: boolean; 6190 } 6191 6192 export interface ConditionalRoot { 6193 node: ConditionalTypeNode; 6194 checkType: Type; 6195 extendsType: Type; 6196 isDistributive: boolean; 6197 inferTypeParameters?: TypeParameter[]; 6198 outerTypeParameters?: TypeParameter[]; 6199 instantiations?: Map<Type>; 6200 aliasSymbol?: Symbol; 6201 aliasTypeArguments?: Type[]; 6202 } 6203 6204 // T extends U ? X : Y (TypeFlags.Conditional) 6205 export interface ConditionalType extends InstantiableType { 6206 root: ConditionalRoot; 6207 checkType: Type; 6208 extendsType: Type; 6209 resolvedTrueType?: Type; 6210 resolvedFalseType?: Type; 6211 /* @internal */ 6212 resolvedInferredTrueType?: Type; // The `trueType` instantiated with the `combinedMapper`, if present 6213 /* @internal */ 6214 resolvedDefaultConstraint?: Type; 6215 /* @internal */ 6216 mapper?: TypeMapper; 6217 /* @internal */ 6218 combinedMapper?: TypeMapper; 6219 } 6220 6221 export interface TemplateLiteralType extends InstantiableType { 6222 texts: readonly string[]; // Always one element longer than types 6223 types: readonly Type[]; // Always at least one element 6224 } 6225 6226 export interface StringMappingType extends InstantiableType { 6227 symbol: Symbol; 6228 type: Type; 6229 } 6230 6231 // Type parameter substitution (TypeFlags.Substitution) 6232 // Substitution types are created for type parameters or indexed access types that occur in the 6233 // true branch of a conditional type. For example, in 'T extends string ? Foo<T> : Bar<T>', the 6234 // reference to T in Foo<T> is resolved as a substitution type that substitutes 'string & T' for T. 6235 // Thus, if Foo has a 'string' constraint on its type parameter, T will satisfy it. Substitution 6236 // types disappear upon instantiation (just like type parameters). 6237 export interface SubstitutionType extends InstantiableType { 6238 objectFlags: ObjectFlags; 6239 baseType: Type; // Target type 6240 constraint: Type; // Constraint that target type is known to satisfy 6241 } 6242 6243 /* @internal */ 6244 export const enum JsxReferenceKind { 6245 Component, 6246 Function, 6247 Mixed 6248 } 6249 6250 export const enum SignatureKind { 6251 Call, 6252 Construct, 6253 } 6254 6255 /* @internal */ 6256 export const enum SignatureFlags { 6257 None = 0, 6258 6259 // Propagating flags 6260 HasRestParameter = 1 << 0, // Indicates last parameter is rest parameter 6261 HasLiteralTypes = 1 << 1, // Indicates signature is specialized 6262 Abstract = 1 << 2, // Indicates signature comes from an abstract class, abstract construct signature, or abstract constructor type 6263 6264 // Non-propagating flags 6265 IsInnerCallChain = 1 << 3, // Indicates signature comes from a CallChain nested in an outer OptionalChain 6266 IsOuterCallChain = 1 << 4, // Indicates signature comes from a CallChain that is the outermost chain of an optional expression 6267 IsUntypedSignatureInJSFile = 1 << 5, // Indicates signature is from a js file and has no types 6268 6269 // We do not propagate `IsInnerCallChain` or `IsOuterCallChain` to instantiated signatures, as that would result in us 6270 // attempting to add `| undefined` on each recursive call to `getReturnTypeOfSignature` when 6271 // instantiating the return type. 6272 PropagatingFlags = HasRestParameter | HasLiteralTypes | Abstract | IsUntypedSignatureInJSFile, 6273 6274 CallChainFlags = IsInnerCallChain | IsOuterCallChain, 6275 } 6276 6277 export interface Signature { 6278 /* @internal */ flags: SignatureFlags; 6279 /* @internal */ checker?: TypeChecker; 6280 declaration?: SignatureDeclaration | JSDocSignature; // Originating declaration 6281 typeParameters?: readonly TypeParameter[]; // Type parameters (undefined if non-generic) 6282 parameters: readonly Symbol[]; // Parameters 6283 /* @internal */ 6284 thisParameter?: Symbol; // symbol of this-type parameter 6285 /* @internal */ 6286 // See comment in `instantiateSignature` for why these are set lazily. 6287 resolvedReturnType?: Type; // Lazily set by `getReturnTypeOfSignature`. 6288 /* @internal */ 6289 // Lazily set by `getTypePredicateOfSignature`. 6290 // `undefined` indicates a type predicate that has not yet been computed. 6291 // Uses a special `noTypePredicate` sentinel value to indicate that there is no type predicate. This looks like a TypePredicate at runtime to avoid polymorphism. 6292 resolvedTypePredicate?: TypePredicate; 6293 /* @internal */ 6294 minArgumentCount: number; // Number of non-optional parameters 6295 /* @internal */ 6296 resolvedMinArgumentCount?: number; // Number of non-optional parameters (excluding trailing `void`) 6297 /* @internal */ 6298 target?: Signature; // Instantiation target 6299 /* @internal */ 6300 mapper?: TypeMapper; // Instantiation mapper 6301 /* @internal */ 6302 compositeSignatures?: Signature[]; // Underlying signatures of a union/intersection signature 6303 /* @internal */ 6304 compositeKind?: TypeFlags; // TypeFlags.Union if the underlying signatures are from union members, otherwise TypeFlags.Intersection 6305 /* @internal */ 6306 erasedSignatureCache?: Signature; // Erased version of signature (deferred) 6307 /* @internal */ 6308 canonicalSignatureCache?: Signature; // Canonical version of signature (deferred) 6309 /* @internal */ 6310 baseSignatureCache?: Signature; // Base version of signature (deferred) 6311 /* @internal */ 6312 optionalCallSignatureCache?: { inner?: Signature, outer?: Signature }; // Optional chained call version of signature (deferred) 6313 /* @internal */ 6314 isolatedSignatureType?: ObjectType; // A manufactured type that just contains the signature for purposes of signature comparison 6315 /* @internal */ 6316 instantiations?: ESMap<string, Signature>; // Generic signature instantiation cache 6317 } 6318 6319 export const enum IndexKind { 6320 String, 6321 Number, 6322 } 6323 6324 export interface IndexInfo { 6325 keyType: Type; 6326 type: Type; 6327 isReadonly: boolean; 6328 declaration?: IndexSignatureDeclaration; 6329 } 6330 6331 /* @internal */ 6332 export const enum TypeMapKind { 6333 Simple, 6334 Array, 6335 Deferred, 6336 Function, 6337 Composite, 6338 Merged, 6339 } 6340 6341 /* @internal */ 6342 export type TypeMapper = 6343 | { kind: TypeMapKind.Simple, source: Type, target: Type } 6344 | { kind: TypeMapKind.Array, sources: readonly Type[], targets: readonly Type[] | undefined } 6345 | { kind: TypeMapKind.Deferred, sources: readonly Type[], targets: (() => Type)[] } 6346 | { kind: TypeMapKind.Function, func: (t: Type) => Type, debugInfo?: () => string } 6347 | { kind: TypeMapKind.Composite | TypeMapKind.Merged, mapper1: TypeMapper, mapper2: TypeMapper }; 6348 6349 export const enum InferencePriority { 6350 NakedTypeVariable = 1 << 0, // Naked type variable in union or intersection type 6351 SpeculativeTuple = 1 << 1, // Speculative tuple inference 6352 SubstituteSource = 1 << 2, // Source of inference originated within a substitution type's substitute 6353 HomomorphicMappedType = 1 << 3, // Reverse inference for homomorphic mapped type 6354 PartialHomomorphicMappedType = 1 << 4, // Partial reverse inference for homomorphic mapped type 6355 MappedTypeConstraint = 1 << 5, // Reverse inference for mapped type 6356 ContravariantConditional = 1 << 6, // Conditional type in contravariant position 6357 ReturnType = 1 << 7, // Inference made from return type of generic function 6358 LiteralKeyof = 1 << 8, // Inference made from a string literal to a keyof T 6359 NoConstraints = 1 << 9, // Don't infer from constraints of instantiable types 6360 AlwaysStrict = 1 << 10, // Always use strict rules for contravariant inferences 6361 MaxValue = 1 << 11, // Seed for inference priority tracking 6362 6363 PriorityImpliesCombination = ReturnType | MappedTypeConstraint | LiteralKeyof, // These priorities imply that the resulting type should be a combination of all candidates 6364 Circularity = -1, // Inference circularity (value less than all other priorities) 6365 } 6366 6367 /* @internal */ 6368 export interface InferenceInfo { 6369 typeParameter: TypeParameter; // Type parameter for which inferences are being made 6370 candidates: Type[] | undefined; // Candidates in covariant positions (or undefined) 6371 contraCandidates: Type[] | undefined; // Candidates in contravariant positions (or undefined) 6372 inferredType?: Type; // Cache for resolved inferred type 6373 priority?: InferencePriority; // Priority of current inference set 6374 topLevel: boolean; // True if all inferences are to top level occurrences 6375 isFixed: boolean; // True if inferences are fixed 6376 impliedArity?: number; 6377 } 6378 6379 /* @internal */ 6380 export const enum InferenceFlags { 6381 None = 0, // No special inference behaviors 6382 NoDefault = 1 << 0, // Infer unknownType for no inferences (otherwise anyType or emptyObjectType) 6383 AnyDefault = 1 << 1, // Infer anyType for no inferences (otherwise emptyObjectType) 6384 SkippedGenericFunction = 1 << 2, // A generic function was skipped during inference 6385 } 6386 6387 /** 6388 * Ternary values are defined such that 6389 * x & y picks the lesser in the order False < Unknown < Maybe < True, and 6390 * x | y picks the greater in the order False < Unknown < Maybe < True. 6391 * Generally, Ternary.Maybe is used as the result of a relation that depends on itself, and 6392 * Ternary.Unknown is used as the result of a variance check that depends on itself. We make 6393 * a distinction because we don't want to cache circular variance check results. 6394 */ 6395 /* @internal */ 6396 export const enum Ternary { 6397 False = 0, 6398 Unknown = 1, 6399 Maybe = 3, 6400 True = -1 6401 } 6402 6403 /* @internal */ 6404 export type TypeComparer = (s: Type, t: Type, reportErrors?: boolean) => Ternary; 6405 6406 /* @internal */ 6407 export interface InferenceContext { 6408 inferences: InferenceInfo[]; // Inferences made for each type parameter 6409 signature?: Signature; // Generic signature for which inferences are made (if any) 6410 flags: InferenceFlags; // Inference flags 6411 compareTypes: TypeComparer; // Type comparer function 6412 mapper: TypeMapper; // Mapper that fixes inferences 6413 nonFixingMapper: TypeMapper; // Mapper that doesn't fix inferences 6414 returnMapper?: TypeMapper; // Type mapper for inferences from return types (if any) 6415 inferredTypeParameters?: readonly TypeParameter[]; // Inferred type parameters for function result 6416 intraExpressionInferenceSites?: IntraExpressionInferenceSite[]; 6417 } 6418 6419 /* @internal */ 6420 export interface IntraExpressionInferenceSite { 6421 node: Expression | MethodDeclaration; 6422 type: Type; 6423 } 6424 6425 /* @internal */ 6426 export interface WideningContext { 6427 parent?: WideningContext; // Parent context 6428 propertyName?: __String; // Name of property in parent 6429 siblings?: Type[]; // Types of siblings 6430 resolvedProperties?: Symbol[]; // Properties occurring in sibling object literals 6431 } 6432 6433 /* @internal */ 6434 export const enum AssignmentDeclarationKind { 6435 None, 6436 /// exports.name = expr 6437 /// module.exports.name = expr 6438 ExportsProperty, 6439 /// module.exports = expr 6440 ModuleExports, 6441 /// className.prototype.name = expr 6442 PrototypeProperty, 6443 /// this.name = expr 6444 ThisProperty, 6445 // F.name = expr 6446 Property, 6447 // F.prototype = { ... } 6448 Prototype, 6449 // Object.defineProperty(x, 'name', { value: any, writable?: boolean (false by default) }); 6450 // Object.defineProperty(x, 'name', { get: Function, set: Function }); 6451 // Object.defineProperty(x, 'name', { get: Function }); 6452 // Object.defineProperty(x, 'name', { set: Function }); 6453 ObjectDefinePropertyValue, 6454 // Object.defineProperty(exports || module.exports, 'name', ...); 6455 ObjectDefinePropertyExports, 6456 // Object.defineProperty(Foo.prototype, 'name', ...); 6457 ObjectDefinePrototypeProperty, 6458 } 6459 6460 /** @deprecated Use FileExtensionInfo instead. */ 6461 export type JsFileExtensionInfo = FileExtensionInfo; 6462 6463 export interface FileExtensionInfo { 6464 extension: string; 6465 isMixedContent: boolean; 6466 scriptKind?: ScriptKind; 6467 } 6468 6469 export interface DiagnosticMessage { 6470 key: string; 6471 category: DiagnosticCategory; 6472 code: number; 6473 message: string; 6474 reportsUnnecessary?: {}; 6475 reportsDeprecated?: {}; 6476 /* @internal */ 6477 elidedInCompatabilityPyramid?: boolean; 6478 } 6479 6480 /** 6481 * A linked list of formatted diagnostic messages to be used as part of a multiline message. 6482 * It is built from the bottom up, leaving the head to be the "main" diagnostic. 6483 * While it seems that DiagnosticMessageChain is structurally similar to DiagnosticMessage, 6484 * the difference is that messages are all preformatted in DMC. 6485 */ 6486 export interface DiagnosticMessageChain { 6487 messageText: string; 6488 category: DiagnosticCategory; 6489 code: number; 6490 next?: DiagnosticMessageChain[]; 6491 } 6492 6493 export interface Diagnostic extends DiagnosticRelatedInformation { 6494 /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */ 6495 reportsUnnecessary?: {}; 6496 6497 reportsDeprecated?: {} 6498 source?: string; 6499 relatedInformation?: DiagnosticRelatedInformation[]; 6500 /* @internal */ skippedOn?: keyof CompilerOptions; 6501 } 6502 6503 export interface DiagnosticRelatedInformation { 6504 category: DiagnosticCategory; 6505 code: number; 6506 file: SourceFile | undefined; 6507 start: number | undefined; 6508 length: number | undefined; 6509 messageText: string | DiagnosticMessageChain; 6510 } 6511 6512 export interface DiagnosticWithLocation extends Diagnostic { 6513 file: SourceFile; 6514 start: number; 6515 length: number; 6516 } 6517 6518 /* @internal*/ 6519 export interface DiagnosticWithDetachedLocation extends Diagnostic { 6520 file: undefined; 6521 fileName: string; 6522 start: number; 6523 length: number; 6524 } 6525 6526 export enum DiagnosticCategory { 6527 Warning, 6528 Error, 6529 Suggestion, 6530 Message 6531 } 6532 /* @internal */ 6533 export function diagnosticCategoryName(d: { category: DiagnosticCategory }, lowerCase = true): string { 6534 const name = DiagnosticCategory[d.category]; 6535 return lowerCase ? name.toLowerCase() : name; 6536 } 6537 6538 export enum ModuleResolutionKind { 6539 Classic = 1, 6540 NodeJs = 2, 6541 // Starting with node12, node's module resolver has significant departures from traditional cjs resolution 6542 // to better support ecmascript modules and their use within node - however more features are still being added. 6543 // TypeScript's Node ESM support was introduced after Node 12 went end-of-life, and Node 14 is the earliest stable 6544 // version that supports both pattern trailers - *but*, Node 16 is the first version that also supports ECMASCript 2022. 6545 // In turn, we offer both a `NodeNext` moving resolution target, and a `Node16` version-anchored resolution target 6546 Node16 = 3, 6547 NodeNext = 99, // Not simply `Node16` so that compiled code linked against TS can use the `Next` value reliably (same as with `ModuleKind`) 6548 } 6549 6550 export enum ModuleDetectionKind { 6551 /** 6552 * Files with imports, exports and/or import.meta are considered modules 6553 */ 6554 Legacy = 1, 6555 /** 6556 * Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node16+ 6557 */ 6558 Auto = 2, 6559 /** 6560 * Consider all non-declaration files modules, regardless of present syntax 6561 */ 6562 Force = 3, 6563 } 6564 6565 export interface PluginImport { 6566 name: string; 6567 } 6568 6569 export interface ProjectReference { 6570 /** A normalized path on disk */ 6571 path: string; 6572 /** The path as the user originally wrote it */ 6573 originalPath?: string; 6574 /** True if the output of this reference should be prepended to the output of this project. Only valid for --outFile compilations */ 6575 prepend?: boolean; 6576 /** True if it is intended that this reference form a circularity */ 6577 circular?: boolean; 6578 } 6579 6580 export enum WatchFileKind { 6581 FixedPollingInterval, 6582 PriorityPollingInterval, 6583 DynamicPriorityPolling, 6584 FixedChunkSizePolling, 6585 UseFsEvents, 6586 UseFsEventsOnParentDirectory, 6587 } 6588 6589 export enum WatchDirectoryKind { 6590 UseFsEvents, 6591 FixedPollingInterval, 6592 DynamicPriorityPolling, 6593 FixedChunkSizePolling, 6594 } 6595 6596 export enum PollingWatchKind { 6597 FixedInterval, 6598 PriorityInterval, 6599 DynamicPriority, 6600 FixedChunkSize, 6601 } 6602 6603 export type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]> | PluginImport[] | ProjectReference[] | null | undefined | EtsOptions; 6604 6605 export interface CompilerOptions { 6606 /*@internal*/ all?: boolean; 6607 allowJs?: boolean; 6608 /*@internal*/ allowNonTsExtensions?: boolean; 6609 allowSyntheticDefaultImports?: boolean; 6610 allowUmdGlobalAccess?: boolean; 6611 allowUnreachableCode?: boolean; 6612 allowUnusedLabels?: boolean; 6613 alwaysStrict?: boolean; // Always combine with strict property 6614 baseUrl?: string; 6615 /** An error if set - this should only go through the -b pipeline and not actually be observed */ 6616 /*@internal*/ 6617 build?: boolean; 6618 charset?: string; 6619 checkJs?: boolean; 6620 /* @internal */ configFilePath?: string; 6621 /** configFile is set as non enumerable property so as to avoid checking of json source files */ 6622 /* @internal */ readonly configFile?: TsConfigSourceFile; 6623 declaration?: boolean; 6624 declarationMap?: boolean; 6625 emitDeclarationOnly?: boolean; 6626 declarationDir?: string; 6627 /* @internal */ diagnostics?: boolean; 6628 /* @internal */ extendedDiagnostics?: boolean; 6629 disableSizeLimit?: boolean; 6630 disableSourceOfProjectReferenceRedirect?: boolean; 6631 disableSolutionSearching?: boolean; 6632 disableReferencedProjectLoad?: boolean; 6633 downlevelIteration?: boolean; 6634 emitBOM?: boolean; 6635 emitDecoratorMetadata?: boolean; 6636 exactOptionalPropertyTypes?: boolean; 6637 experimentalDecorators?: boolean; 6638 forceConsistentCasingInFileNames?: boolean; 6639 /*@internal*/generateCpuProfile?: string; 6640 /*@internal*/generateTrace?: string; 6641 /*@internal*/help?: boolean; 6642 importHelpers?: boolean; 6643 importsNotUsedAsValues?: ImportsNotUsedAsValues; 6644 /*@internal*/init?: boolean; 6645 inlineSourceMap?: boolean; 6646 inlineSources?: boolean; 6647 isolatedModules?: boolean; 6648 jsx?: JsxEmit; 6649 keyofStringsOnly?: boolean; 6650 lib?: string[]; 6651 /*@internal*/listEmittedFiles?: boolean; 6652 /*@internal*/listFiles?: boolean; 6653 /*@internal*/explainFiles?: boolean; 6654 /*@internal*/listFilesOnly?: boolean; 6655 locale?: string; 6656 mapRoot?: string; 6657 maxNodeModuleJsDepth?: number; 6658 module?: ModuleKind; 6659 moduleResolution?: ModuleResolutionKind; 6660 moduleSuffixes?: string[]; 6661 moduleDetection?: ModuleDetectionKind; 6662 newLine?: NewLineKind; 6663 noEmit?: boolean; 6664 /*@internal*/noEmitForJsFiles?: boolean; 6665 noEmitHelpers?: boolean; 6666 noEmitOnError?: boolean; 6667 noErrorTruncation?: boolean; 6668 noFallthroughCasesInSwitch?: boolean; 6669 noImplicitAny?: boolean; // Always combine with strict property 6670 noImplicitReturns?: boolean; 6671 noImplicitThis?: boolean; // Always combine with strict property 6672 noStrictGenericChecks?: boolean; 6673 noUnusedLocals?: boolean; 6674 noUnusedParameters?: boolean; 6675 noImplicitUseStrict?: boolean; 6676 noPropertyAccessFromIndexSignature?: boolean; 6677 assumeChangesOnlyAffectDirectDependencies?: boolean; 6678 noLib?: boolean; 6679 noResolve?: boolean; 6680 /*@internal*/ 6681 noDtsResolution?: boolean; 6682 noUncheckedIndexedAccess?: boolean; 6683 out?: string; 6684 outDir?: string; 6685 outFile?: string; 6686 paths?: MapLike<string[]>; 6687 /** The directory of the config file that specified 'paths'. Used to resolve relative paths when 'baseUrl' is absent. */ 6688 /*@internal*/ pathsBasePath?: string; 6689 /*@internal*/ plugins?: PluginImport[]; 6690 preserveConstEnums?: boolean; 6691 noImplicitOverride?: boolean; 6692 preserveSymlinks?: boolean; 6693 preserveValueImports?: boolean; 6694 /* @internal */ preserveWatchOutput?: boolean; 6695 project?: string; 6696 /* @internal */ pretty?: boolean; 6697 reactNamespace?: string; 6698 jsxFactory?: string; 6699 jsxFragmentFactory?: string; 6700 jsxImportSource?: string; 6701 composite?: boolean; 6702 incremental?: boolean; 6703 tsBuildInfoFile?: string; 6704 removeComments?: boolean; 6705 rootDir?: string; 6706 rootDirs?: string[]; 6707 skipLibCheck?: boolean; 6708 skipDefaultLibCheck?: boolean; 6709 sourceMap?: boolean; 6710 sourceRoot?: string; 6711 strict?: boolean; 6712 strictFunctionTypes?: boolean; // Always combine with strict property 6713 strictBindCallApply?: boolean; // Always combine with strict property 6714 strictNullChecks?: boolean; // Always combine with strict property 6715 strictPropertyInitialization?: boolean; // Always combine with strict property 6716 stripInternal?: boolean; 6717 suppressExcessPropertyErrors?: boolean; 6718 suppressImplicitAnyIndexErrors?: boolean; 6719 /* @internal */ suppressOutputPathCheck?: boolean; 6720 target?: ScriptTarget; 6721 traceResolution?: boolean; 6722 useUnknownInCatchVariables?: boolean; 6723 resolveJsonModule?: boolean; 6724 types?: string[]; 6725 /** Paths used to compute primary types search locations */ 6726 typeRoots?: string[]; 6727 /*@internal*/ version?: boolean; 6728 /*@internal*/ watch?: boolean; 6729 esModuleInterop?: boolean; 6730 /* @internal */ showConfig?: boolean; 6731 useDefineForClassFields?: boolean; 6732 ets?: EtsOptions; 6733 packageManagerType?: string; 6734 emitNodeModulesFiles?: boolean; 6735 etsLoaderPath?: string; 6736 [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; 6737 } 6738 6739 export interface EtsOptions { 6740 render: { method: string[]; decorator: string }; 6741 components: string[]; 6742 libs: string[]; 6743 extend: { 6744 decorator: string[]; 6745 components: { name: string; type: string; instance: string }[]; 6746 }; 6747 styles: { 6748 decorator: string; 6749 component: { name: string; type: string; instance: string }; 6750 property: string; 6751 }; 6752 concurrent: { 6753 decorator: string; 6754 }; 6755 customComponent?: string; 6756 propertyDecorators: { 6757 name: string; 6758 needInitialization: boolean; 6759 }[]; 6760 emitDecorators: { 6761 name: string, 6762 emitParameters: boolean 6763 }[]; 6764 } 6765 6766 export interface WatchOptions { 6767 watchFile?: WatchFileKind; 6768 watchDirectory?: WatchDirectoryKind; 6769 fallbackPolling?: PollingWatchKind; 6770 synchronousWatchDirectory?: boolean; 6771 excludeDirectories?: string[]; 6772 excludeFiles?: string[]; 6773 6774 [option: string]: CompilerOptionsValue | undefined; 6775 } 6776 6777 export interface TypeAcquisition { 6778 /** 6779 * @deprecated typingOptions.enableAutoDiscovery 6780 * Use typeAcquisition.enable instead. 6781 */ 6782 enableAutoDiscovery?: boolean; 6783 enable?: boolean; 6784 include?: string[]; 6785 exclude?: string[]; 6786 disableFilenameBasedTypeAcquisition?: boolean; 6787 [option: string]: CompilerOptionsValue | undefined; 6788 } 6789 6790 export enum ModuleKind { 6791 None = 0, 6792 CommonJS = 1, 6793 AMD = 2, 6794 UMD = 3, 6795 System = 4, 6796 6797 // NOTE: ES module kinds should be contiguous to more easily check whether a module kind is *any* ES module kind. 6798 // Non-ES module kinds should not come between ES2015 (the earliest ES module kind) and ESNext (the last ES 6799 // module kind). 6800 ES2015 = 5, 6801 ES2020 = 6, 6802 ES2022 = 7, 6803 ESNext = 99, 6804 6805 // Node16+ is an amalgam of commonjs (albeit updated) and es2022+, and represents a distinct module system from es2020/esnext 6806 Node16 = 100, 6807 NodeNext = 199, 6808 } 6809 6810 export const enum JsxEmit { 6811 None = 0, 6812 Preserve = 1, 6813 React = 2, 6814 ReactNative = 3, 6815 ReactJSX = 4, 6816 ReactJSXDev = 5, 6817 } 6818 6819 export const enum ImportsNotUsedAsValues { 6820 Remove, 6821 Preserve, 6822 Error, 6823 } 6824 6825 export const enum NewLineKind { 6826 CarriageReturnLineFeed = 0, 6827 LineFeed = 1 6828 } 6829 6830 export interface LineAndCharacter { 6831 /** 0-based. */ 6832 line: number; 6833 /* 6834 * 0-based. This value denotes the character position in line and is different from the 'column' because of tab characters. 6835 */ 6836 character: number; 6837 } 6838 6839 export const enum ScriptKind { 6840 Unknown = 0, 6841 JS = 1, 6842 JSX = 2, 6843 TS = 3, 6844 TSX = 4, 6845 External = 5, 6846 JSON = 6, 6847 /** 6848 * Used on extensions that doesn't define the ScriptKind but the content defines it. 6849 * Deferred extensions are going to be included in all project contexts. 6850 */ 6851 Deferred = 7, 6852 ETS = 8, 6853 } 6854 6855 export const enum ScriptTarget { 6856 ES3 = 0, 6857 ES5 = 1, 6858 ES2015 = 2, 6859 ES2016 = 3, 6860 ES2017 = 4, 6861 ES2018 = 5, 6862 ES2019 = 6, 6863 ES2020 = 7, 6864 ES2021 = 8, 6865 ES2022 = 9, 6866 ESNext = 99, 6867 JSON = 100, 6868 Latest = ESNext, 6869 } 6870 6871 export const enum LanguageVariant { 6872 Standard, 6873 JSX 6874 } 6875 6876 /** Either a parsed command line or a parsed tsconfig.json */ 6877 export interface ParsedCommandLine { 6878 options: CompilerOptions; 6879 typeAcquisition?: TypeAcquisition; 6880 fileNames: string[]; 6881 projectReferences?: readonly ProjectReference[]; 6882 watchOptions?: WatchOptions; 6883 raw?: any; 6884 errors: Diagnostic[]; 6885 wildcardDirectories?: MapLike<WatchDirectoryFlags>; 6886 compileOnSave?: boolean; 6887 } 6888 6889 export const enum WatchDirectoryFlags { 6890 None = 0, 6891 Recursive = 1 << 0, 6892 } 6893 6894 /* @internal */ 6895 export interface ConfigFileSpecs { 6896 filesSpecs: readonly string[] | undefined; 6897 /** 6898 * Present to report errors (user specified specs), validatedIncludeSpecs are used for file name matching 6899 */ 6900 includeSpecs: readonly string[] | undefined; 6901 /** 6902 * Present to report errors (user specified specs), validatedExcludeSpecs are used for file name matching 6903 */ 6904 excludeSpecs: readonly string[] | undefined; 6905 validatedFilesSpec: readonly string[] | undefined; 6906 validatedIncludeSpecs: readonly string[] | undefined; 6907 validatedExcludeSpecs: readonly string[] | undefined; 6908 pathPatterns: readonly (string | Pattern)[] | undefined; 6909 isDefaultIncludeSpec: boolean; 6910 } 6911 6912 /* @internal */ 6913 export type RequireResult<T = {}> = 6914 | { module: T, modulePath?: string, error: undefined } 6915 | { module: undefined, modulePath?: undefined, error: { stack?: string, message?: string } }; 6916 6917 export interface CreateProgramOptions { 6918 rootNames: readonly string[]; 6919 options: CompilerOptions; 6920 projectReferences?: readonly ProjectReference[]; 6921 host?: CompilerHost; 6922 oldProgram?: Program; 6923 configFileParsingDiagnostics?: readonly Diagnostic[]; 6924 } 6925 6926 /* @internal */ 6927 export interface CommandLineOptionBase { 6928 name: string; 6929 type: "string" | "number" | "boolean" | "object" | "list" | ESMap<string, number | string>; // a value of a primitive type, or an object literal mapping named values to actual values 6930 isFilePath?: boolean; // True if option value is a path or fileName 6931 shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help' 6932 description?: DiagnosticMessage; // The message describing what the command line switch does. 6933 defaultValueDescription?: string | number | boolean | DiagnosticMessage; // The message describing what the dafault value is. string type is prepared for fixed chosen like "false" which do not need I18n. 6934 paramType?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter 6935 isTSConfigOnly?: boolean; // True if option can only be specified via tsconfig.json file 6936 isCommandLineOnly?: boolean; 6937 showInSimplifiedHelpView?: boolean; 6938 category?: DiagnosticMessage; 6939 strictFlag?: true; // true if the option is one of the flag under strict 6940 affectsSourceFile?: true; // true if we should recreate SourceFiles after this option changes 6941 affectsModuleResolution?: true; // currently same effect as `affectsSourceFile` 6942 affectsBindDiagnostics?: true; // true if this affects binding (currently same effect as `affectsSourceFile`) 6943 affectsSemanticDiagnostics?: true; // true if option affects semantic diagnostics 6944 affectsEmit?: true; // true if the options affects emit 6945 affectsProgramStructure?: true; // true if program should be reconstructed from root files if option changes and does not affect module resolution as affectsModuleResolution indirectly means program needs to reconstructed 6946 affectsDeclarationPath?: true; // true if the options affects declaration file path computed 6947 affectsMultiFileEmitBuildInfo?: true; // true if this options should be emitted in buildInfo without --out 6948 affectsBundleEmitBuildInfo?: true; // true if this options should be emitted in buildInfo with --out 6949 transpileOptionValue?: boolean | undefined; // If set this means that the option should be set to this value when transpiling 6950 extraValidation?: (value: CompilerOptionsValue) => [DiagnosticMessage, ...string[]] | undefined; // Additional validation to be performed for the value to be valid 6951 } 6952 6953 /* @internal */ 6954 export interface CommandLineOptionOfStringType extends CommandLineOptionBase { 6955 type: "string"; 6956 defaultValueDescription?: string | undefined | DiagnosticMessage; 6957 } 6958 6959 /* @internal */ 6960 export interface CommandLineOptionOfNumberType extends CommandLineOptionBase { 6961 type: "number"; 6962 defaultValueDescription: number | undefined | DiagnosticMessage; 6963 } 6964 6965 /* @internal */ 6966 export interface CommandLineOptionOfBooleanType extends CommandLineOptionBase { 6967 type: "boolean"; 6968 defaultValueDescription: boolean | undefined | DiagnosticMessage; 6969 } 6970 6971 /* @internal */ 6972 export interface CommandLineOptionOfCustomType extends CommandLineOptionBase { 6973 type: ESMap<string, number | string>; // an object literal mapping named values to actual values 6974 defaultValueDescription: number | string | undefined | DiagnosticMessage; 6975 } 6976 6977 /* @internal */ 6978 export interface AlternateModeDiagnostics { 6979 diagnostic: DiagnosticMessage; 6980 getOptionsNameMap: () => OptionsNameMap; 6981 } 6982 6983 /* @internal */ 6984 export interface DidYouMeanOptionsDiagnostics { 6985 alternateMode?: AlternateModeDiagnostics; 6986 optionDeclarations: CommandLineOption[]; 6987 unknownOptionDiagnostic: DiagnosticMessage, 6988 unknownDidYouMeanDiagnostic: DiagnosticMessage, 6989 } 6990 6991 /* @internal */ 6992 export interface TsConfigOnlyOption extends CommandLineOptionBase { 6993 type: "object"; 6994 elementOptions?: ESMap<string, CommandLineOption>; 6995 extraKeyDiagnostics?: DidYouMeanOptionsDiagnostics; 6996 } 6997 6998 /* @internal */ 6999 export interface CommandLineOptionOfListType extends CommandLineOptionBase { 7000 type: "list"; 7001 element: CommandLineOptionOfCustomType | CommandLineOptionOfStringType | CommandLineOptionOfNumberType | CommandLineOptionOfBooleanType | TsConfigOnlyOption; 7002 listPreserveFalsyValues?: boolean; 7003 } 7004 7005 /* @internal */ 7006 export type CommandLineOption = CommandLineOptionOfCustomType | CommandLineOptionOfStringType | CommandLineOptionOfNumberType | CommandLineOptionOfBooleanType | TsConfigOnlyOption | CommandLineOptionOfListType; 7007 7008 /* @internal */ 7009 export const enum CharacterCodes { 7010 nullCharacter = 0, 7011 maxAsciiCharacter = 0x7F, 7012 7013 lineFeed = 0x0A, // \n 7014 carriageReturn = 0x0D, // \r 7015 lineSeparator = 0x2028, 7016 paragraphSeparator = 0x2029, 7017 nextLine = 0x0085, 7018 7019 // Unicode 3.0 space characters 7020 space = 0x0020, // " " 7021 nonBreakingSpace = 0x00A0, // 7022 enQuad = 0x2000, 7023 emQuad = 0x2001, 7024 enSpace = 0x2002, 7025 emSpace = 0x2003, 7026 threePerEmSpace = 0x2004, 7027 fourPerEmSpace = 0x2005, 7028 sixPerEmSpace = 0x2006, 7029 figureSpace = 0x2007, 7030 punctuationSpace = 0x2008, 7031 thinSpace = 0x2009, 7032 hairSpace = 0x200A, 7033 zeroWidthSpace = 0x200B, 7034 narrowNoBreakSpace = 0x202F, 7035 ideographicSpace = 0x3000, 7036 mathematicalSpace = 0x205F, 7037 ogham = 0x1680, 7038 7039 _ = 0x5F, 7040 $ = 0x24, 7041 7042 _0 = 0x30, 7043 _1 = 0x31, 7044 _2 = 0x32, 7045 _3 = 0x33, 7046 _4 = 0x34, 7047 _5 = 0x35, 7048 _6 = 0x36, 7049 _7 = 0x37, 7050 _8 = 0x38, 7051 _9 = 0x39, 7052 7053 a = 0x61, 7054 b = 0x62, 7055 c = 0x63, 7056 d = 0x64, 7057 e = 0x65, 7058 f = 0x66, 7059 g = 0x67, 7060 h = 0x68, 7061 i = 0x69, 7062 j = 0x6A, 7063 k = 0x6B, 7064 l = 0x6C, 7065 m = 0x6D, 7066 n = 0x6E, 7067 o = 0x6F, 7068 p = 0x70, 7069 q = 0x71, 7070 r = 0x72, 7071 s = 0x73, 7072 t = 0x74, 7073 u = 0x75, 7074 v = 0x76, 7075 w = 0x77, 7076 x = 0x78, 7077 y = 0x79, 7078 z = 0x7A, 7079 7080 A = 0x41, 7081 B = 0x42, 7082 C = 0x43, 7083 D = 0x44, 7084 E = 0x45, 7085 F = 0x46, 7086 G = 0x47, 7087 H = 0x48, 7088 I = 0x49, 7089 J = 0x4A, 7090 K = 0x4B, 7091 L = 0x4C, 7092 M = 0x4D, 7093 N = 0x4E, 7094 O = 0x4F, 7095 P = 0x50, 7096 Q = 0x51, 7097 R = 0x52, 7098 S = 0x53, 7099 T = 0x54, 7100 U = 0x55, 7101 V = 0x56, 7102 W = 0x57, 7103 X = 0x58, 7104 Y = 0x59, 7105 Z = 0x5a, 7106 7107 ampersand = 0x26, // & 7108 asterisk = 0x2A, // * 7109 at = 0x40, // @ 7110 backslash = 0x5C, // \ 7111 backtick = 0x60, // ` 7112 bar = 0x7C, // | 7113 caret = 0x5E, // ^ 7114 closeBrace = 0x7D, // } 7115 closeBracket = 0x5D, // ] 7116 closeParen = 0x29, // ) 7117 colon = 0x3A, // : 7118 comma = 0x2C, // , 7119 dot = 0x2E, // . 7120 doubleQuote = 0x22, // " 7121 equals = 0x3D, // = 7122 exclamation = 0x21, // ! 7123 greaterThan = 0x3E, // > 7124 hash = 0x23, // # 7125 lessThan = 0x3C, // < 7126 minus = 0x2D, // - 7127 openBrace = 0x7B, // { 7128 openBracket = 0x5B, // [ 7129 openParen = 0x28, // ( 7130 percent = 0x25, // % 7131 plus = 0x2B, // + 7132 question = 0x3F, // ? 7133 semicolon = 0x3B, // ; 7134 singleQuote = 0x27, // ' 7135 slash = 0x2F, // / 7136 tilde = 0x7E, // ~ 7137 7138 backspace = 0x08, // \b 7139 formFeed = 0x0C, // \f 7140 byteOrderMark = 0xFEFF, 7141 tab = 0x09, // \t 7142 verticalTab = 0x0B, // \v 7143 } 7144 7145 export interface ModuleResolutionHost { 7146 // TODO: GH#18217 Optional methods frequently used as non-optional 7147 7148 fileExists(fileName: string): boolean; 7149 // readFile function is used to read arbitrary text files on disk, i.e. when resolution procedure needs the content of 'package.json' 7150 // to determine location of bundled typings for node module 7151 readFile(fileName: string): string | undefined; 7152 trace?(s: string): void; 7153 directoryExists?(directoryName: string): boolean; 7154 /** 7155 * Resolve a symbolic link. 7156 * @see https://nodejs.org/api/fs.html#fs_fs_realpathsync_path_options 7157 */ 7158 realpath?(path: string): string; 7159 getCurrentDirectory?(): string; 7160 getDirectories?(path: string): string[]; 7161 useCaseSensitiveFileNames?: boolean | (() => boolean) | undefined; 7162 getJsDocNodeCheckedConfig?(jsDocFileCheckInfo: FileCheckModuleInfo, symbolSourceFilePath: string): JsDocNodeCheckConfig; 7163 getJsDocNodeConditionCheckedResult?(jsDocFileCheckedInfo: FileCheckModuleInfo, jsDocs: JsDocTagInfo[]): ConditionCheckResult; 7164 getFileCheckedModuleInfo?(containFilePath: string): FileCheckModuleInfo; 7165 } 7166 7167 /** 7168 * Used by services to specify the minimum host area required to set up source files under any compilation settings 7169 */ 7170 export interface MinimalResolutionCacheHost extends ModuleResolutionHost { 7171 getCompilationSettings(): CompilerOptions; 7172 getCompilerHost?(): CompilerHost | undefined; 7173 } 7174 7175 /** 7176 * Represents the result of module resolution. 7177 * Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off. 7178 * The Program will then filter results based on these flags. 7179 * 7180 * Prefer to return a `ResolvedModuleFull` so that the file type does not have to be inferred. 7181 */ 7182 export interface ResolvedModule { 7183 /** Path of the file the module was resolved to. */ 7184 resolvedFileName: string; 7185 /** True if `resolvedFileName` comes from `node_modules`. */ 7186 isExternalLibraryImport?: boolean; 7187 } 7188 7189 /** 7190 * ResolvedModule with an explicitly provided `extension` property. 7191 * Prefer this over `ResolvedModule`. 7192 * If changing this, remember to change `moduleResolutionIsEqualTo`. 7193 */ 7194 export interface ResolvedModuleFull extends ResolvedModule { 7195 /** 7196 * @internal 7197 * This is a file name with preserved original casing, not a normalized `Path`. 7198 */ 7199 readonly originalPath?: string; 7200 /** 7201 * Extension of resolvedFileName. This must match what's at the end of resolvedFileName. 7202 * This is optional for backwards-compatibility, but will be added if not provided. 7203 */ 7204 extension: Extension; 7205 packageId?: PackageId; 7206 } 7207 7208 /** 7209 * Unique identifier with a package name and version. 7210 * If changing this, remember to change `packageIdIsEqual`. 7211 */ 7212 export interface PackageId { 7213 /** 7214 * Name of the package. 7215 * Should not include `@types`. 7216 * If accessing a non-index file, this should include its name e.g. "foo/bar". 7217 */ 7218 name: string; 7219 /** 7220 * Name of a submodule within this package. 7221 * May be "". 7222 */ 7223 subModuleName: string; 7224 /** Version of the package, e.g. "1.2.3" */ 7225 version: string; 7226 } 7227 7228 export const enum Extension { 7229 Ts = ".ts", 7230 Tsx = ".tsx", 7231 Dts = ".d.ts", 7232 Js = ".js", 7233 Jsx = ".jsx", 7234 Json = ".json", 7235 TsBuildInfo = ".tsbuildinfo", 7236 Mjs = ".mjs", 7237 Mts = ".mts", 7238 Dmts = ".d.mts", 7239 Cjs = ".cjs", 7240 Cts = ".cts", 7241 Dcts = ".d.cts", 7242 Ets = ".ets", 7243 Dets = ".d.ets" 7244 } 7245 7246 export interface ResolvedModuleWithFailedLookupLocations { 7247 readonly resolvedModule: ResolvedModuleFull | undefined; 7248 /* @internal */ 7249 readonly failedLookupLocations: string[]; 7250 /* @internal */ 7251 readonly affectingLocations: string[]; 7252 /* @internal */ 7253 readonly resolutionDiagnostics: Diagnostic[] 7254 } 7255 7256 export interface ResolvedTypeReferenceDirective { 7257 // True if the type declaration file was found in a primary lookup location 7258 primary: boolean; 7259 // The location of the .d.ts file we located, or undefined if resolution failed 7260 resolvedFileName: string | undefined; 7261 /** 7262 * @internal 7263 * The location of the symlink to the .d.ts file we found, if `resolvedFileName` was the realpath. 7264 * This is a file name with preserved original casing, not a normalized `Path`. 7265 */ 7266 originalPath?: string; 7267 packageId?: PackageId; 7268 /** True if `resolvedFileName` comes from `node_modules` or `oh_modules`. */ 7269 isExternalLibraryImport?: boolean; 7270 } 7271 7272 export interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations { 7273 readonly resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective | undefined; 7274 readonly failedLookupLocations: string[]; 7275 /*@internal*/ readonly affectingLocations: string[]; 7276 /* @internal */ resolutionDiagnostics: Diagnostic[]; 7277 } 7278 7279 /* @internal */ 7280 export type HasInvalidatedResolutions = (sourceFile: Path) => boolean; 7281 /* @internal */ 7282 export type HasChangedAutomaticTypeDirectiveNames = () => boolean; 7283 7284 export interface FileCheckModuleInfo { 7285 fileNeedCheck: boolean; 7286 checkPayload: any; 7287 currentFileName: string; 7288 } 7289 7290 export interface JsDocNodeCheckConfig { 7291 nodeNeedCheck: boolean; 7292 checkConfig: JsDocNodeCheckConfigItem[]; 7293 } 7294 7295 export interface JsDocNodeCheckConfigItem { 7296 tagName: string[]; 7297 message: string; 7298 needConditionCheck: boolean; 7299 type: DiagnosticCategory; 7300 specifyCheckConditionFuncName: string; 7301 tagNameShouldExisted: boolean; 7302 checkValidCallback?: (jsDocTag: JSDocTag, config: JsDocNodeCheckConfigItem) => boolean; 7303 checkJsDocSpecialValidCallback?: (jsDocTags: readonly JSDocTag[], config: JsDocNodeCheckConfigItem) => boolean; 7304 } 7305 7306 export interface TagCheckParam { 7307 needCheck: boolean; 7308 checkConfig: TagCheckConfig[]; 7309 } 7310 export interface TagCheckConfig { 7311 tagName: string; 7312 message: string; 7313 needConditionCheck: boolean; 7314 specifyCheckConditionFuncName: string; 7315 } 7316 export interface ConditionCheckResult { 7317 valid: boolean; 7318 type?: DiagnosticCategory; 7319 message?: string; 7320 } 7321 export interface CompilerHost extends ModuleResolutionHost { 7322 getSourceFile(fileName: string, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined; 7323 getSourceFileByPath?(fileName: string, path: Path, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined; 7324 getCancellationToken?(): CancellationToken; 7325 getDefaultLibFileName(options: CompilerOptions): string; 7326 getDefaultLibLocation?(): string; 7327 writeFile: WriteFileCallback; 7328 getCurrentDirectory(): string; 7329 getCanonicalFileName(fileName: string): string; 7330 useCaseSensitiveFileNames(): boolean; 7331 getNewLine(): string; 7332 readDirectory?(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[], depth?: number): string[]; 7333 7334 /* 7335 * CompilerHost must either implement resolveModuleNames (in case if it wants to be completely in charge of 7336 * module name resolution) or provide implementation for methods from ModuleResolutionHost (in this case compiler 7337 * will apply built-in module resolution logic and use members of ModuleResolutionHost to ask host specific questions). 7338 * If resolveModuleNames is implemented then implementation for members from ModuleResolutionHost can be just 7339 * 'throw new Error("NotImplemented")' 7340 */ 7341 resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[]; 7342 /** 7343 * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it 7344 */ 7345 getModuleResolutionCache?(): ModuleResolutionCache | undefined; 7346 /** 7347 * This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files 7348 */ 7349 resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; 7350 getEnvironmentVariable?(name: string): string | undefined; 7351 /* @internal */ onReleaseOldSourceFile?(oldSourceFile: SourceFile, oldOptions: CompilerOptions, hasSourceFileByPath: boolean): void; 7352 /* @internal */ onReleaseParsedCommandLine?(configFileName: string, oldResolvedRef: ResolvedProjectReference | undefined, optionOptions: CompilerOptions): void; 7353 /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ 7354 hasInvalidatedResolutions?(filePath: Path): boolean; 7355 /* @internal */ hasChangedAutomaticTypeDirectiveNames?: HasChangedAutomaticTypeDirectiveNames; 7356 createHash?(data: string): string; 7357 getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined; 7358 /* @internal */ useSourceOfProjectReferenceRedirect?(): boolean; 7359 7360 // TODO: later handle this in better way in builder host instead once the api for tsbuild finalizes and doesn't use compilerHost as base 7361 /*@internal*/createDirectory?(directory: string): void; 7362 /*@internal*/getSymlinkCache?(): SymlinkCache; 7363 7364 // For testing: 7365 /*@internal*/ disableUseFileVersionAsSignature?: boolean; 7366 /*@internal*/ storeFilesChangingSignatureDuringEmit?: boolean; 7367 /** 7368 * get tagName where need to be determined based on the file path 7369 * @param jsDocFileCheckInfo filePath 7370 * @param symbolSourceFilePath filePath 7371 */ 7372 getJsDocNodeCheckedConfig?(jsDocFileCheckInfo: FileCheckModuleInfo, symbolSourceFilePath: string): JsDocNodeCheckConfig; 7373 /** 7374 * get checked results based on the file path and jsDocs 7375 * @param jsDocFileCheckedInfo 7376 * @param jsDocs 7377 */ 7378 getJsDocNodeConditionCheckedResult?(jsDocFileCheckedInfo: FileCheckModuleInfo, jsDocs: JsDocTagInfo[]): ConditionCheckResult; 7379 getFileCheckedModuleInfo?(containFilePath: string): FileCheckModuleInfo; 7380 7381 // For ark incremental build 7382 getLastCompiledProgram?(): Program; 7383 } 7384 7385 /** true if --out otherwise source file name */ 7386 /*@internal*/ 7387 export type SourceOfProjectReferenceRedirect = string | true; 7388 7389 /*@internal*/ 7390 export interface ResolvedProjectReferenceCallbacks { 7391 getSourceOfProjectReferenceRedirect(fileName: string): SourceOfProjectReferenceRedirect | undefined; 7392 forEachResolvedProjectReference<T>(cb: (resolvedProjectReference: ResolvedProjectReference) => T | undefined): T | undefined; 7393 } 7394 7395 /* @internal */ 7396 export const enum TransformFlags { 7397 None = 0, 7398 7399 // Facts 7400 // - Flags used to indicate that a node or subtree contains syntax that requires transformation. 7401 ContainsTypeScript = 1 << 0, 7402 ContainsJsx = 1 << 1, 7403 ContainsESNext = 1 << 2, 7404 ContainsES2022 = 1 << 3, 7405 ContainsES2021 = 1 << 4, 7406 ContainsES2020 = 1 << 5, 7407 ContainsES2019 = 1 << 6, 7408 ContainsES2018 = 1 << 7, 7409 ContainsES2017 = 1 << 8, 7410 ContainsES2016 = 1 << 9, 7411 ContainsES2015 = 1 << 10, 7412 ContainsGenerator = 1 << 11, 7413 ContainsDestructuringAssignment = 1 << 12, 7414 7415 // Markers 7416 // - Flags used to indicate that a subtree contains a specific transformation. 7417 ContainsTypeScriptClassSyntax = 1 << 13, // Property Initializers, Parameter Property Initializers 7418 ContainsLexicalThis = 1 << 14, 7419 ContainsRestOrSpread = 1 << 15, 7420 ContainsObjectRestOrSpread = 1 << 16, 7421 ContainsComputedPropertyName = 1 << 17, 7422 ContainsBlockScopedBinding = 1 << 18, 7423 ContainsBindingPattern = 1 << 19, 7424 ContainsYield = 1 << 20, 7425 ContainsAwait = 1 << 21, 7426 ContainsHoistedDeclarationOrCompletion = 1 << 22, 7427 ContainsDynamicImport = 1 << 23, 7428 ContainsClassFields = 1 << 24, 7429 ContainsDecorators = 1 << 25, 7430 ContainsPossibleTopLevelAwait = 1 << 26, 7431 ContainsLexicalSuper = 1 << 27, 7432 ContainsUpdateExpressionForIdentifier = 1 << 28, 7433 ContainsPrivateIdentifierInExpression = 1 << 29, 7434 7435 HasComputedFlags = 1 << 31, // Transform flags have been computed. 7436 7437 // Assertions 7438 // - Bitmasks that are used to assert facts about the syntax of a node and its subtree. 7439 AssertTypeScript = ContainsTypeScript, 7440 AssertJsx = ContainsJsx, 7441 AssertESNext = ContainsESNext, 7442 AssertES2022 = ContainsES2022, 7443 AssertES2021 = ContainsES2021, 7444 AssertES2020 = ContainsES2020, 7445 AssertES2019 = ContainsES2019, 7446 AssertES2018 = ContainsES2018, 7447 AssertES2017 = ContainsES2017, 7448 AssertES2016 = ContainsES2016, 7449 AssertES2015 = ContainsES2015, 7450 AssertGenerator = ContainsGenerator, 7451 AssertDestructuringAssignment = ContainsDestructuringAssignment, 7452 7453 // Scope Exclusions 7454 // - Bitmasks that exclude flags from propagating out of a specific context 7455 // into the subtree flags of their container. 7456 OuterExpressionExcludes = HasComputedFlags, 7457 PropertyAccessExcludes = OuterExpressionExcludes, 7458 NodeExcludes = PropertyAccessExcludes, 7459 ArrowFunctionExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsBlockScopedBinding | ContainsYield | ContainsAwait | ContainsHoistedDeclarationOrCompletion | ContainsBindingPattern | ContainsObjectRestOrSpread | ContainsPossibleTopLevelAwait, 7460 FunctionExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsLexicalThis | ContainsLexicalSuper | ContainsBlockScopedBinding | ContainsYield | ContainsAwait | ContainsHoistedDeclarationOrCompletion | ContainsBindingPattern | ContainsObjectRestOrSpread | ContainsPossibleTopLevelAwait, 7461 ConstructorExcludes = NodeExcludes | ContainsLexicalThis | ContainsLexicalSuper | ContainsBlockScopedBinding | ContainsYield | ContainsAwait | ContainsHoistedDeclarationOrCompletion | ContainsBindingPattern | ContainsObjectRestOrSpread | ContainsPossibleTopLevelAwait, 7462 MethodOrAccessorExcludes = NodeExcludes | ContainsLexicalThis | ContainsLexicalSuper | ContainsBlockScopedBinding | ContainsYield | ContainsAwait | ContainsHoistedDeclarationOrCompletion | ContainsBindingPattern | ContainsObjectRestOrSpread, 7463 PropertyExcludes = NodeExcludes | ContainsLexicalThis | ContainsLexicalSuper, 7464 ClassExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsComputedPropertyName, 7465 ModuleExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsLexicalThis | ContainsLexicalSuper | ContainsBlockScopedBinding | ContainsHoistedDeclarationOrCompletion | ContainsPossibleTopLevelAwait, 7466 TypeExcludes = ~ContainsTypeScript, 7467 ObjectLiteralExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsComputedPropertyName | ContainsObjectRestOrSpread, 7468 ArrayLiteralOrCallOrNewExcludes = NodeExcludes | ContainsRestOrSpread, 7469 VariableDeclarationListExcludes = NodeExcludes | ContainsBindingPattern | ContainsObjectRestOrSpread, 7470 ParameterExcludes = NodeExcludes, 7471 CatchClauseExcludes = NodeExcludes | ContainsObjectRestOrSpread, 7472 BindingPatternExcludes = NodeExcludes | ContainsRestOrSpread, 7473 ContainsLexicalThisOrSuper = ContainsLexicalThis | ContainsLexicalSuper, 7474 7475 // Propagating flags 7476 // - Bitmasks for flags that should propagate from a child 7477 PropertyNamePropagatingFlags = ContainsLexicalThis | ContainsLexicalSuper, 7478 7479 // Masks 7480 // - Additional bitmasks 7481 } 7482 7483 export interface SourceMapRange extends TextRange { 7484 source?: SourceMapSource; 7485 } 7486 7487 export interface SourceMapSource { 7488 fileName: string; 7489 text: string; 7490 /* @internal */ lineMap: readonly number[]; 7491 skipTrivia?: (pos: number) => number; 7492 } 7493 7494 /* @internal */ 7495 export interface EmitNode { 7496 annotatedNodes?: Node[]; // Tracks Parse-tree nodes with EmitNodes for eventual cleanup. 7497 flags: EmitFlags; // Flags that customize emit 7498 leadingComments?: SynthesizedComment[]; // Synthesized leading comments 7499 trailingComments?: SynthesizedComment[]; // Synthesized trailing comments 7500 commentRange?: TextRange; // The text range to use when emitting leading or trailing comments 7501 sourceMapRange?: SourceMapRange; // The text range to use when emitting leading or trailing source mappings 7502 tokenSourceMapRanges?: (SourceMapRange | undefined)[]; // The text range to use when emitting source mappings for tokens 7503 constantValue?: string | number; // The constant value of an expression 7504 externalHelpersModuleName?: Identifier; // The local name for an imported helpers module 7505 externalHelpers?: boolean; 7506 helpers?: EmitHelper[]; // Emit helpers for the node 7507 startsOnNewLine?: boolean; // If the node should begin on a new line 7508 snippetElement?: SnippetElement; // Snippet element of the node 7509 typeNode?: TypeNode; // VariableDeclaration type 7510 } 7511 7512 /* @internal */ 7513 export type SnippetElement = TabStop | Placeholder; 7514 7515 /* @internal */ 7516 export interface TabStop { 7517 kind: SnippetKind.TabStop; 7518 order: number; 7519 } 7520 7521 /* @internal */ 7522 export interface Placeholder { 7523 kind: SnippetKind.Placeholder; 7524 order: number; 7525 } 7526 7527 // Reference: https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax 7528 /* @internal */ 7529 export const enum SnippetKind { 7530 TabStop, // `$1`, `$2` 7531 Placeholder, // `${1:foo}` 7532 Choice, // `${1|one,two,three|}` 7533 Variable, // `$name`, `${name:default}` 7534 } 7535 7536 export const enum EmitFlags { 7537 None = 0, 7538 SingleLine = 1 << 0, // The contents of this node should be emitted on a single line. 7539 AdviseOnEmitNode = 1 << 1, // The printer should invoke the onEmitNode callback when printing this node. 7540 NoSubstitution = 1 << 2, // Disables further substitution of an expression. 7541 CapturesThis = 1 << 3, // The function captures a lexical `this` 7542 NoLeadingSourceMap = 1 << 4, // Do not emit a leading source map location for this node. 7543 NoTrailingSourceMap = 1 << 5, // Do not emit a trailing source map location for this node. 7544 NoSourceMap = NoLeadingSourceMap | NoTrailingSourceMap, // Do not emit a source map location for this node. 7545 NoNestedSourceMaps = 1 << 6, // Do not emit source map locations for children of this node. 7546 NoTokenLeadingSourceMaps = 1 << 7, // Do not emit leading source map location for token nodes. 7547 NoTokenTrailingSourceMaps = 1 << 8, // Do not emit trailing source map location for token nodes. 7548 NoTokenSourceMaps = NoTokenLeadingSourceMaps | NoTokenTrailingSourceMaps, // Do not emit source map locations for tokens of this node. 7549 NoLeadingComments = 1 << 9, // Do not emit leading comments for this node. 7550 NoTrailingComments = 1 << 10, // Do not emit trailing comments for this node. 7551 NoComments = NoLeadingComments | NoTrailingComments, // Do not emit comments for this node. 7552 NoNestedComments = 1 << 11, 7553 HelperName = 1 << 12, // The Identifier refers to an *unscoped* emit helper (one that is emitted at the top of the file) 7554 ExportName = 1 << 13, // Ensure an export prefix is added for an identifier that points to an exported declaration with a local name (see SymbolFlags.ExportHasLocal). 7555 LocalName = 1 << 14, // Ensure an export prefix is not added for an identifier that points to an exported declaration. 7556 InternalName = 1 << 15, // The name is internal to an ES5 class body function. 7557 Indented = 1 << 16, // Adds an explicit extra indentation level for class and function bodies when printing (used to match old emitter). 7558 NoIndentation = 1 << 17, // Do not indent the node. 7559 AsyncFunctionBody = 1 << 18, 7560 ReuseTempVariableScope = 1 << 19, // Reuse the existing temp variable scope during emit. 7561 CustomPrologue = 1 << 20, // Treat the statement as if it were a prologue directive (NOTE: Prologue directives are *not* transformed). 7562 NoHoisting = 1 << 21, // Do not hoist this declaration in --module system 7563 HasEndOfDeclarationMarker = 1 << 22, // Declaration has an associated NotEmittedStatement to mark the end of the declaration 7564 Iterator = 1 << 23, // The expression to a `yield*` should be treated as an Iterator when down-leveling, not an Iterable. 7565 NoAsciiEscaping = 1 << 24, // When synthesizing nodes that lack an original node or textSourceNode, we want to write the text on the node with ASCII escaping substitutions. 7566 /*@internal*/ TypeScriptClassWrapper = 1 << 25, // The node is an IIFE class wrapper created by the ts transform. 7567 /*@internal*/ NeverApplyImportHelper = 1 << 26, // Indicates the node should never be wrapped with an import star helper (because, for example, it imports tslib itself) 7568 /*@internal*/ IgnoreSourceNewlines = 1 << 27, // Overrides `printerOptions.preserveSourceNewlines` to print this node (and all descendants) with default whitespace. 7569 /*@internal*/ Immutable = 1 << 28, // Indicates a node is a singleton intended to be reused in multiple locations. Any attempt to make further changes to the node will result in an error. 7570 /*@internal*/ IndirectCall = 1 << 29, // Emit CallExpression as an indirect call: `(0, f)()` 7571 } 7572 7573 export interface EmitHelperBase { 7574 readonly name: string; // A unique name for this helper. 7575 readonly scoped: boolean; // Indicates whether the helper MUST be emitted in the current scope. 7576 readonly text: string | ((node: EmitHelperUniqueNameCallback) => string); // ES3-compatible raw script text, or a function yielding such a string 7577 readonly priority?: number; // Helpers with a higher priority are emitted earlier than other helpers on the node. 7578 readonly dependencies?: EmitHelper[] 7579 } 7580 7581 export interface ScopedEmitHelper extends EmitHelperBase { 7582 readonly scoped: true; 7583 } 7584 7585 export interface UnscopedEmitHelper extends EmitHelperBase { 7586 readonly scoped: false; // Indicates whether the helper MUST be emitted in the current scope. 7587 /* @internal */ 7588 readonly importName?: string; // The name of the helper to use when importing via `--importHelpers`. 7589 readonly text: string; // ES3-compatible raw script text, or a function yielding such a string 7590 } 7591 7592 export type EmitHelper = ScopedEmitHelper | UnscopedEmitHelper; 7593 7594 /* @internal */ 7595 export type UniqueNameHandler = (baseName: string, checkFn?: (name: string) => boolean, optimistic?: boolean) => string; 7596 7597 export type EmitHelperUniqueNameCallback = (name: string) => string; 7598 7599 /** 7600 * Used by the checker, this enum keeps track of external emit helpers that should be type 7601 * checked. 7602 */ 7603 /* @internal */ 7604 export const enum ExternalEmitHelpers { 7605 Extends = 1 << 0, // __extends (used by the ES2015 class transformation) 7606 Assign = 1 << 1, // __assign (used by Jsx and ESNext object spread transformations) 7607 Rest = 1 << 2, // __rest (used by ESNext object rest transformation) 7608 Decorate = 1 << 3, // __decorate (used by TypeScript decorators transformation) 7609 Metadata = 1 << 4, // __metadata (used by TypeScript decorators transformation) 7610 Param = 1 << 5, // __param (used by TypeScript decorators transformation) 7611 Awaiter = 1 << 6, // __awaiter (used by ES2017 async functions transformation) 7612 Generator = 1 << 7, // __generator (used by ES2015 generator transformation) 7613 Values = 1 << 8, // __values (used by ES2015 for..of and yield* transformations) 7614 Read = 1 << 9, // __read (used by ES2015 iterator destructuring transformation) 7615 SpreadArray = 1 << 10, // __spreadArray (used by ES2015 array spread and argument list spread transformations) 7616 Await = 1 << 11, // __await (used by ES2017 async generator transformation) 7617 AsyncGenerator = 1 << 12, // __asyncGenerator (used by ES2017 async generator transformation) 7618 AsyncDelegator = 1 << 13, // __asyncDelegator (used by ES2017 async generator yield* transformation) 7619 AsyncValues = 1 << 14, // __asyncValues (used by ES2017 for..await..of transformation) 7620 ExportStar = 1 << 15, // __exportStar (used by CommonJS/AMD/UMD module transformation) 7621 ImportStar = 1 << 16, // __importStar (used by CommonJS/AMD/UMD module transformation) 7622 ImportDefault = 1 << 17, // __importStar (used by CommonJS/AMD/UMD module transformation) 7623 MakeTemplateObject = 1 << 18, // __makeTemplateObject (used for constructing template string array objects) 7624 ClassPrivateFieldGet = 1 << 19, // __classPrivateFieldGet (used by the class private field transformation) 7625 ClassPrivateFieldSet = 1 << 20, // __classPrivateFieldSet (used by the class private field transformation) 7626 ClassPrivateFieldIn = 1 << 21, // __classPrivateFieldIn (used by the class private field transformation) 7627 CreateBinding = 1 << 22, // __createBinding (use by the module transform for (re)exports and namespace imports) 7628 FirstEmitHelper = Extends, 7629 LastEmitHelper = CreateBinding, 7630 7631 // Helpers included by ES2015 for..of 7632 ForOfIncludes = Values, 7633 7634 // Helpers included by ES2017 for..await..of 7635 ForAwaitOfIncludes = AsyncValues, 7636 7637 // Helpers included by ES2017 async generators 7638 AsyncGeneratorIncludes = Await | AsyncGenerator, 7639 7640 // Helpers included by yield* in ES2017 async generators 7641 AsyncDelegatorIncludes = Await | AsyncDelegator | AsyncValues, 7642 7643 // Helpers included by ES2015 spread 7644 SpreadIncludes = Read | SpreadArray, 7645 } 7646 7647 export const enum EmitHint { 7648 SourceFile, // Emitting a SourceFile 7649 Expression, // Emitting an Expression 7650 IdentifierName, // Emitting an IdentifierName 7651 MappedTypeParameter, // Emitting a TypeParameterDeclaration inside of a MappedTypeNode 7652 Unspecified, // Emitting an otherwise unspecified node 7653 EmbeddedStatement, // Emitting an embedded statement 7654 JsxAttributeValue, // Emitting a JSX attribute value 7655 } 7656 7657 export interface SourceFileMayBeEmittedHost { 7658 getCompilerOptions(): CompilerOptions; 7659 isSourceFileFromExternalLibrary(file: SourceFile): boolean; 7660 getResolvedProjectReferenceToRedirect(fileName: string): ResolvedProjectReference | undefined; 7661 isSourceOfProjectReferenceRedirect(fileName: string): boolean; 7662 } 7663 7664 export interface EmitHost extends ScriptReferenceHost, ModuleSpecifierResolutionHost, SourceFileMayBeEmittedHost { 7665 getSourceFiles(): readonly SourceFile[]; 7666 useCaseSensitiveFileNames(): boolean; 7667 getCurrentDirectory(): string; 7668 7669 getLibFileFromReference(ref: FileReference): SourceFile | undefined; 7670 7671 getCommonSourceDirectory(): string; 7672 getCanonicalFileName(fileName: string): string; 7673 getNewLine(): string; 7674 7675 isEmitBlocked(emitFileName: string): boolean; 7676 7677 getPrependNodes(): readonly (InputFiles | UnparsedSource)[]; 7678 7679 writeFile: WriteFileCallback; 7680 /* @internal */ 7681 getProgramBuildInfo(): ProgramBuildInfo | undefined; 7682 getSourceFileFromReference: Program["getSourceFileFromReference"]; 7683 readonly redirectTargetsMap: RedirectTargetsMap; 7684 createHash?(data: string): string; 7685 } 7686 7687 /* @internal */ 7688 export interface PropertyDescriptorAttributes { 7689 enumerable?: boolean | Expression; 7690 configurable?: boolean | Expression; 7691 writable?: boolean | Expression; 7692 value?: Expression; 7693 get?: Expression; 7694 set?: Expression; 7695 } 7696 7697 export const enum OuterExpressionKinds { 7698 Parentheses = 1 << 0, 7699 TypeAssertions = 1 << 1, 7700 NonNullAssertions = 1 << 2, 7701 PartiallyEmittedExpressions = 1 << 3, 7702 7703 Assertions = TypeAssertions | NonNullAssertions, 7704 All = Parentheses | Assertions | PartiallyEmittedExpressions, 7705 7706 ExcludeJSDocTypeAssertion = 1 << 4, 7707 } 7708 7709 /* @internal */ 7710 export type OuterExpression = 7711 | ParenthesizedExpression 7712 | TypeAssertion 7713 | SatisfiesExpression 7714 | AsExpression 7715 | NonNullExpression 7716 | PartiallyEmittedExpression; 7717 7718 export type TypeOfTag = "undefined" | "number" | "bigint" | "boolean" | "string" | "symbol" | "object" | "function"; 7719 7720 /* @internal */ 7721 export interface CallBinding { 7722 target: LeftHandSideExpression; 7723 thisArg: Expression; 7724 } 7725 7726 /* @internal */ 7727 export interface ParenthesizerRules { 7728 getParenthesizeLeftSideOfBinaryForOperator(binaryOperator: SyntaxKind): (leftSide: Expression) => Expression; 7729 getParenthesizeRightSideOfBinaryForOperator(binaryOperator: SyntaxKind): (rightSide: Expression) => Expression; 7730 parenthesizeLeftSideOfBinary(binaryOperator: SyntaxKind, leftSide: Expression): Expression; 7731 parenthesizeRightSideOfBinary(binaryOperator: SyntaxKind, leftSide: Expression | undefined, rightSide: Expression): Expression; 7732 parenthesizeExpressionOfComputedPropertyName(expression: Expression): Expression; 7733 parenthesizeConditionOfConditionalExpression(condition: Expression): Expression; 7734 parenthesizeBranchOfConditionalExpression(branch: Expression): Expression; 7735 parenthesizeExpressionOfExportDefault(expression: Expression): Expression; 7736 parenthesizeExpressionOfNew(expression: Expression): LeftHandSideExpression; 7737 parenthesizeLeftSideOfAccess(expression: Expression, optionalChain?: boolean): LeftHandSideExpression; 7738 parenthesizeOperandOfPostfixUnary(operand: Expression): LeftHandSideExpression; 7739 parenthesizeOperandOfPrefixUnary(operand: Expression): UnaryExpression; 7740 parenthesizeExpressionsOfCommaDelimitedList(elements: readonly Expression[]): NodeArray<Expression>; 7741 parenthesizeExpressionForDisallowedComma(expression: Expression): Expression; 7742 parenthesizeExpressionOfExpressionStatement(expression: Expression): Expression; 7743 parenthesizeConciseBodyOfArrowFunction(body: Expression): Expression; 7744 parenthesizeConciseBodyOfArrowFunction(body: ConciseBody): ConciseBody; 7745 parenthesizeCheckTypeOfConditionalType(type: TypeNode): TypeNode; 7746 parenthesizeExtendsTypeOfConditionalType(type: TypeNode): TypeNode; 7747 parenthesizeOperandOfTypeOperator(type: TypeNode): TypeNode; 7748 parenthesizeOperandOfReadonlyTypeOperator(type: TypeNode): TypeNode; 7749 parenthesizeNonArrayTypeOfPostfixType(type: TypeNode): TypeNode; 7750 parenthesizeElementTypesOfTupleType(types: readonly (TypeNode | NamedTupleMember)[]): NodeArray<TypeNode>; 7751 parenthesizeElementTypeOfTupleType(type: TypeNode | NamedTupleMember): TypeNode | NamedTupleMember; 7752 parenthesizeTypeOfOptionalType(type: TypeNode): TypeNode; 7753 parenthesizeConstituentTypeOfUnionType(type: TypeNode): TypeNode; 7754 parenthesizeConstituentTypesOfUnionType(constituents: readonly TypeNode[]): NodeArray<TypeNode>; 7755 parenthesizeConstituentTypeOfIntersectionType(type: TypeNode): TypeNode; 7756 parenthesizeConstituentTypesOfIntersectionType(constituents: readonly TypeNode[]): NodeArray<TypeNode>; 7757 parenthesizeLeadingTypeArgument(typeNode: TypeNode): TypeNode; 7758 parenthesizeTypeArguments(typeParameters: readonly TypeNode[] | undefined): NodeArray<TypeNode> | undefined; 7759 } 7760 7761 /* @internal */ 7762 export interface NodeConverters { 7763 convertToFunctionBlock(node: ConciseBody, multiLine?: boolean): Block; 7764 convertToFunctionExpression(node: FunctionDeclaration): FunctionExpression; 7765 convertToArrayAssignmentElement(element: ArrayBindingOrAssignmentElement): Expression; 7766 convertToObjectAssignmentElement(element: ObjectBindingOrAssignmentElement): ObjectLiteralElementLike; 7767 convertToAssignmentPattern(node: BindingOrAssignmentPattern): AssignmentPattern; 7768 convertToObjectAssignmentPattern(node: ObjectBindingOrAssignmentPattern): ObjectLiteralExpression; 7769 convertToArrayAssignmentPattern(node: ArrayBindingOrAssignmentPattern): ArrayLiteralExpression; 7770 convertToAssignmentElementTarget(node: BindingOrAssignmentElementTarget): Expression; 7771 } 7772 7773 /* @internal */ 7774 export interface GeneratedNamePart { 7775 /** an additional prefix to insert before the text sourced from `node` */ 7776 prefix?: string; 7777 node: Identifier | PrivateIdentifier; 7778 /** an additional suffix to insert after the text sourced from `node` */ 7779 suffix?: string; 7780 } 7781 7782 export interface NodeFactory { 7783 /* @internal */ readonly parenthesizer: ParenthesizerRules; 7784 /* @internal */ readonly converters: NodeConverters; 7785 /* @internal */ readonly baseFactory: BaseNodeFactory; 7786 /* @internal */ readonly flags: NodeFactoryFlags; 7787 createNodeArray<T extends Node>(elements?: readonly T[], hasTrailingComma?: boolean): NodeArray<T>; 7788 7789 // 7790 // Literals 7791 // 7792 7793 createNumericLiteral(value: string | number, numericLiteralFlags?: TokenFlags): NumericLiteral; 7794 createBigIntLiteral(value: string | PseudoBigInt): BigIntLiteral; 7795 createStringLiteral(text: string, isSingleQuote?: boolean): StringLiteral; 7796 /* @internal*/ createStringLiteral(text: string, isSingleQuote?: boolean, hasExtendedUnicodeEscape?: boolean): StringLiteral; // eslint-disable-line @typescript-eslint/unified-signatures 7797 createStringLiteralFromNode(sourceNode: PropertyNameLiteral | PrivateIdentifier, isSingleQuote?: boolean): StringLiteral; 7798 createRegularExpressionLiteral(text: string): RegularExpressionLiteral; 7799 7800 // 7801 // Identifiers 7802 // 7803 7804 createIdentifier(text: string): Identifier; 7805 /* @internal */ createIdentifier(text: string, typeArguments?: readonly (TypeNode | TypeParameterDeclaration)[], originalKeywordKind?: SyntaxKind, hasExtendedUnicodeEscape?: boolean): Identifier; // eslint-disable-line @typescript-eslint/unified-signatures 7806 /* @internal */ updateIdentifier(node: Identifier, typeArguments: NodeArray<TypeNode | TypeParameterDeclaration> | undefined): Identifier; 7807 7808 /** 7809 * Create a unique temporary variable. 7810 * @param recordTempVariable An optional callback used to record the temporary variable name. This 7811 * should usually be a reference to `hoistVariableDeclaration` from a `TransformationContext`, but 7812 * can be `undefined` if you plan to record the temporary variable manually. 7813 * @param reservedInNestedScopes When `true`, reserves the temporary variable name in all nested scopes 7814 * during emit so that the variable can be referenced in a nested function body. This is an alternative to 7815 * setting `EmitFlags.ReuseTempVariableScope` on the nested function itself. 7816 */ 7817 createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined, reservedInNestedScopes?: boolean): Identifier; 7818 /*@internal*/ createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined, reservedInNestedScopes?: boolean, prefix?: string | GeneratedNamePart, suffix?: string): Identifier; // eslint-disable-line @typescript-eslint/unified-signatures 7819 7820 /** 7821 * Create a unique temporary variable for use in a loop. 7822 * @param reservedInNestedScopes When `true`, reserves the temporary variable name in all nested scopes 7823 * during emit so that the variable can be referenced in a nested function body. This is an alternative to 7824 * setting `EmitFlags.ReuseTempVariableScope` on the nested function itself. 7825 */ 7826 createLoopVariable(reservedInNestedScopes?: boolean): Identifier; 7827 7828 /** Create a unique name based on the supplied text. */ 7829 createUniqueName(text: string, flags?: GeneratedIdentifierFlags): Identifier; 7830 /*@internal*/ createUniqueName(text: string, flags?: GeneratedIdentifierFlags, prefix?: string | GeneratedNamePart, suffix?: string): Identifier; // eslint-disable-line @typescript-eslint/unified-signatures 7831 7832 /** Create a unique name generated for a node. */ 7833 getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags): Identifier; 7834 /*@internal*/ getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags, prefix?: string | GeneratedNamePart, suffix?: string): Identifier; // eslint-disable-line @typescript-eslint/unified-signatures 7835 7836 createPrivateIdentifier(text: string): PrivateIdentifier 7837 createUniquePrivateName(text?: string): PrivateIdentifier; 7838 /*@internal*/ createUniquePrivateName(text?: string, prefix?: string | GeneratedNamePart, suffix?: string): PrivateIdentifier; // eslint-disable-line @typescript-eslint/unified-signatures 7839 getGeneratedPrivateNameForNode(node: Node): PrivateIdentifier; 7840 /*@internal*/ getGeneratedPrivateNameForNode(node: Node, prefix?: string | GeneratedNamePart, suffix?: string): PrivateIdentifier; // eslint-disable-line @typescript-eslint/unified-signatures 7841 7842 // 7843 // Punctuation 7844 // 7845 7846 createToken(token: SyntaxKind.SuperKeyword): SuperExpression; 7847 createToken(token: SyntaxKind.ThisKeyword): ThisExpression; 7848 createToken(token: SyntaxKind.NullKeyword): NullLiteral; 7849 createToken(token: SyntaxKind.TrueKeyword): TrueLiteral; 7850 createToken(token: SyntaxKind.FalseKeyword): FalseLiteral; 7851 createToken<TKind extends PunctuationSyntaxKind>(token: TKind): PunctuationToken<TKind>; 7852 createToken<TKind extends KeywordTypeSyntaxKind>(token: TKind): KeywordTypeNode<TKind>; 7853 createToken<TKind extends ModifierSyntaxKind>(token: TKind): ModifierToken<TKind>; 7854 createToken<TKind extends KeywordSyntaxKind>(token: TKind): KeywordToken<TKind>; 7855 createToken<TKind extends SyntaxKind.Unknown | SyntaxKind.EndOfFileToken>(token: TKind): Token<TKind>; 7856 /*@internal*/ createToken<TKind extends SyntaxKind>(token: TKind): Token<TKind>; 7857 7858 // 7859 // Reserved words 7860 // 7861 7862 createSuper(): SuperExpression; 7863 createThis(): ThisExpression; 7864 createNull(): NullLiteral; 7865 createTrue(): TrueLiteral; 7866 createFalse(): FalseLiteral; 7867 7868 // 7869 // Modifiers 7870 // 7871 7872 createModifier<T extends ModifierSyntaxKind>(kind: T): ModifierToken<T>; 7873 createModifiersFromModifierFlags(flags: ModifierFlags): Modifier[] | undefined; 7874 7875 // 7876 // Names 7877 // 7878 7879 createQualifiedName(left: EntityName, right: string | Identifier): QualifiedName; 7880 updateQualifiedName(node: QualifiedName, left: EntityName, right: Identifier): QualifiedName; 7881 createComputedPropertyName(expression: Expression): ComputedPropertyName; 7882 updateComputedPropertyName(node: ComputedPropertyName, expression: Expression): ComputedPropertyName; 7883 7884 // 7885 // Signature elements 7886 // 7887 7888 createTypeParameterDeclaration(modifiers: readonly Modifier[] | undefined, name: string | Identifier, constraint?: TypeNode, defaultType?: TypeNode): TypeParameterDeclaration; 7889 updateTypeParameterDeclaration(node: TypeParameterDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, constraint: TypeNode | undefined, defaultType: TypeNode | undefined): TypeParameterDeclaration; 7890 createParameterDeclaration(modifiers: readonly ModifierLike[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression): ParameterDeclaration; 7891 updateParameterDeclaration(node: ParameterDeclaration, modifiers: readonly ModifierLike[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): ParameterDeclaration; 7892 createDecorator(expression: Expression): Decorator; 7893 updateDecorator(node: Decorator, expression: Expression): Decorator; 7894 7895 // 7896 // Type Elements 7897 // 7898 7899 createPropertySignature(modifiers: readonly Modifier[] | undefined, name: PropertyName | string, questionToken: QuestionToken | undefined, type: TypeNode | undefined): PropertySignature; 7900 updatePropertySignature(node: PropertySignature, modifiers: readonly Modifier[] | undefined, name: PropertyName, questionToken: QuestionToken | undefined, type: TypeNode | undefined): PropertySignature; 7901 createPropertyDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | PropertyName, questionOrExclamationToken: QuestionToken | ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertyDeclaration; 7902 updatePropertyDeclaration(node: PropertyDeclaration, modifiers: readonly ModifierLike[] | undefined, name: string | PropertyName, questionOrExclamationToken: QuestionToken | ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertyDeclaration; 7903 createMethodSignature(modifiers: readonly Modifier[] | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): MethodSignature; 7904 updateMethodSignature(node: MethodSignature, modifiers: readonly Modifier[] | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined): MethodSignature; 7905 createMethodDeclaration(modifiers: readonly ModifierLike[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; 7906 updateMethodDeclaration(node: MethodDeclaration, modifiers: readonly ModifierLike[] | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; 7907 createConstructorDeclaration(modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; 7908 updateConstructorDeclaration(node: ConstructorDeclaration, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; 7909 createGetAccessorDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; 7910 updateGetAccessorDeclaration(node: GetAccessorDeclaration, modifiers: readonly ModifierLike[] | undefined, name: PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; 7911 createSetAccessorDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; 7912 updateSetAccessorDeclaration(node: SetAccessorDeclaration, modifiers: readonly ModifierLike[] | undefined, name: PropertyName, parameters: readonly ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; 7913 createCallSignature(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): CallSignatureDeclaration; 7914 updateCallSignature(node: CallSignatureDeclaration, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined): CallSignatureDeclaration; 7915 createConstructSignature(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration; 7916 updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined): ConstructSignatureDeclaration; 7917 createIndexSignature(modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; 7918 /* @internal */ createIndexSignature(modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): IndexSignatureDeclaration; // eslint-disable-line @typescript-eslint/unified-signatures 7919 updateIndexSignature(node: IndexSignatureDeclaration, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; 7920 createTemplateLiteralTypeSpan(type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; 7921 updateTemplateLiteralTypeSpan(node: TemplateLiteralTypeSpan, type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; 7922 createClassStaticBlockDeclaration(body: Block): ClassStaticBlockDeclaration; 7923 updateClassStaticBlockDeclaration(node: ClassStaticBlockDeclaration, body: Block): ClassStaticBlockDeclaration; 7924 7925 // 7926 // Types 7927 // 7928 7929 createKeywordTypeNode<TKind extends KeywordTypeSyntaxKind>(kind: TKind): KeywordTypeNode<TKind>; 7930 createTypePredicateNode(assertsModifier: AssertsKeyword | undefined, parameterName: Identifier | ThisTypeNode | string, type: TypeNode | undefined): TypePredicateNode; 7931 updateTypePredicateNode(node: TypePredicateNode, assertsModifier: AssertsKeyword | undefined, parameterName: Identifier | ThisTypeNode, type: TypeNode | undefined): TypePredicateNode; 7932 createTypeReferenceNode(typeName: string | EntityName, typeArguments?: readonly TypeNode[]): TypeReferenceNode; 7933 updateTypeReferenceNode(node: TypeReferenceNode, typeName: EntityName, typeArguments: NodeArray<TypeNode> | undefined): TypeReferenceNode; 7934 createFunctionTypeNode(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): FunctionTypeNode; 7935 updateFunctionTypeNode(node: FunctionTypeNode, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode): FunctionTypeNode; 7936 createConstructorTypeNode(modifiers: readonly Modifier[] | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): ConstructorTypeNode; 7937 updateConstructorTypeNode(node: ConstructorTypeNode, modifiers: readonly Modifier[] | undefined, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode): ConstructorTypeNode; 7938 createTypeQueryNode(exprName: EntityName, typeArguments?: readonly TypeNode[]): TypeQueryNode; 7939 updateTypeQueryNode(node: TypeQueryNode, exprName: EntityName, typeArguments?: readonly TypeNode[]): TypeQueryNode; 7940 createTypeLiteralNode(members: readonly TypeElement[] | undefined): TypeLiteralNode; 7941 updateTypeLiteralNode(node: TypeLiteralNode, members: NodeArray<TypeElement>): TypeLiteralNode; 7942 createArrayTypeNode(elementType: TypeNode): ArrayTypeNode; 7943 updateArrayTypeNode(node: ArrayTypeNode, elementType: TypeNode): ArrayTypeNode; 7944 createTupleTypeNode(elements: readonly (TypeNode | NamedTupleMember)[]): TupleTypeNode; 7945 updateTupleTypeNode(node: TupleTypeNode, elements: readonly (TypeNode | NamedTupleMember)[]): TupleTypeNode; 7946 createNamedTupleMember(dotDotDotToken: DotDotDotToken | undefined, name: Identifier, questionToken: QuestionToken | undefined, type: TypeNode): NamedTupleMember; 7947 updateNamedTupleMember(node: NamedTupleMember, dotDotDotToken: DotDotDotToken | undefined, name: Identifier, questionToken: QuestionToken | undefined, type: TypeNode): NamedTupleMember; 7948 createOptionalTypeNode(type: TypeNode): OptionalTypeNode; 7949 updateOptionalTypeNode(node: OptionalTypeNode, type: TypeNode): OptionalTypeNode; 7950 createRestTypeNode(type: TypeNode): RestTypeNode; 7951 updateRestTypeNode(node: RestTypeNode, type: TypeNode): RestTypeNode; 7952 createUnionTypeNode(types: readonly TypeNode[]): UnionTypeNode; 7953 updateUnionTypeNode(node: UnionTypeNode, types: NodeArray<TypeNode>): UnionTypeNode; 7954 createIntersectionTypeNode(types: readonly TypeNode[]): IntersectionTypeNode; 7955 updateIntersectionTypeNode(node: IntersectionTypeNode, types: NodeArray<TypeNode>): IntersectionTypeNode; 7956 createConditionalTypeNode(checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; 7957 updateConditionalTypeNode(node: ConditionalTypeNode, checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; 7958 createInferTypeNode(typeParameter: TypeParameterDeclaration): InferTypeNode; 7959 updateInferTypeNode(node: InferTypeNode, typeParameter: TypeParameterDeclaration): InferTypeNode; 7960 createImportTypeNode(argument: TypeNode, assertions?: ImportTypeAssertionContainer, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; 7961 updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, assertions: ImportTypeAssertionContainer | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; 7962 createParenthesizedType(type: TypeNode): ParenthesizedTypeNode; 7963 updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode; 7964 createThisTypeNode(): ThisTypeNode; 7965 createTypeOperatorNode(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword, type: TypeNode): TypeOperatorNode; 7966 updateTypeOperatorNode(node: TypeOperatorNode, type: TypeNode): TypeOperatorNode; 7967 createIndexedAccessTypeNode(objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode; 7968 updateIndexedAccessTypeNode(node: IndexedAccessTypeNode, objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode; 7969 createMappedTypeNode(readonlyToken: ReadonlyKeyword | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, nameType: TypeNode | undefined, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined, members: NodeArray<TypeElement> | undefined): MappedTypeNode; 7970 updateMappedTypeNode(node: MappedTypeNode, readonlyToken: ReadonlyKeyword | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, nameType: TypeNode | undefined, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined, members: NodeArray<TypeElement> | undefined): MappedTypeNode; 7971 createLiteralTypeNode(literal: LiteralTypeNode["literal"]): LiteralTypeNode; 7972 updateLiteralTypeNode(node: LiteralTypeNode, literal: LiteralTypeNode["literal"]): LiteralTypeNode; 7973 createTemplateLiteralType(head: TemplateHead, templateSpans: readonly TemplateLiteralTypeSpan[]): TemplateLiteralTypeNode; 7974 updateTemplateLiteralType(node: TemplateLiteralTypeNode, head: TemplateHead, templateSpans: readonly TemplateLiteralTypeSpan[]): TemplateLiteralTypeNode; 7975 7976 // 7977 // Binding Patterns 7978 // 7979 7980 createObjectBindingPattern(elements: readonly BindingElement[]): ObjectBindingPattern; 7981 updateObjectBindingPattern(node: ObjectBindingPattern, elements: readonly BindingElement[]): ObjectBindingPattern; 7982 createArrayBindingPattern(elements: readonly ArrayBindingElement[]): ArrayBindingPattern; 7983 updateArrayBindingPattern(node: ArrayBindingPattern, elements: readonly ArrayBindingElement[]): ArrayBindingPattern; 7984 createBindingElement(dotDotDotToken: DotDotDotToken | undefined, propertyName: string | PropertyName | undefined, name: string | BindingName, initializer?: Expression): BindingElement; 7985 updateBindingElement(node: BindingElement, dotDotDotToken: DotDotDotToken | undefined, propertyName: PropertyName | undefined, name: BindingName, initializer: Expression | undefined): BindingElement; 7986 7987 // 7988 // Expression 7989 // 7990 7991 createArrayLiteralExpression(elements?: readonly Expression[], multiLine?: boolean): ArrayLiteralExpression; 7992 updateArrayLiteralExpression(node: ArrayLiteralExpression, elements: readonly Expression[]): ArrayLiteralExpression; 7993 createObjectLiteralExpression(properties?: readonly ObjectLiteralElementLike[], multiLine?: boolean): ObjectLiteralExpression; 7994 updateObjectLiteralExpression(node: ObjectLiteralExpression, properties: readonly ObjectLiteralElementLike[]): ObjectLiteralExpression; 7995 createPropertyAccessExpression(expression: Expression, name: string | MemberName): PropertyAccessExpression; 7996 updatePropertyAccessExpression(node: PropertyAccessExpression, expression: Expression, name: MemberName): PropertyAccessExpression; 7997 createPropertyAccessChain(expression: Expression, questionDotToken: QuestionDotToken | undefined, name: string | MemberName): PropertyAccessChain; 7998 updatePropertyAccessChain(node: PropertyAccessChain, expression: Expression, questionDotToken: QuestionDotToken | undefined, name: MemberName): PropertyAccessChain; 7999 createElementAccessExpression(expression: Expression, index: number | Expression): ElementAccessExpression; 8000 updateElementAccessExpression(node: ElementAccessExpression, expression: Expression, argumentExpression: Expression): ElementAccessExpression; 8001 createElementAccessChain(expression: Expression, questionDotToken: QuestionDotToken | undefined, index: number | Expression): ElementAccessChain; 8002 updateElementAccessChain(node: ElementAccessChain, expression: Expression, questionDotToken: QuestionDotToken | undefined, argumentExpression: Expression): ElementAccessChain; 8003 createCallExpression(expression: Expression, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[] | undefined): CallExpression; 8004 updateCallExpression(node: CallExpression, expression: Expression, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[]): CallExpression; 8005 createCallChain(expression: Expression, questionDotToken: QuestionDotToken | undefined, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[] | undefined): CallChain; 8006 updateCallChain(node: CallChain, expression: Expression, questionDotToken: QuestionDotToken | undefined, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[]): CallChain; 8007 createNewExpression(expression: Expression, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[] | undefined): NewExpression; 8008 updateNewExpression(node: NewExpression, expression: Expression, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[] | undefined): NewExpression; 8009 createTaggedTemplateExpression(tag: Expression, typeArguments: readonly TypeNode[] | undefined, template: TemplateLiteral): TaggedTemplateExpression; 8010 updateTaggedTemplateExpression(node: TaggedTemplateExpression, tag: Expression, typeArguments: readonly TypeNode[] | undefined, template: TemplateLiteral): TaggedTemplateExpression; 8011 createTypeAssertion(type: TypeNode, expression: Expression): TypeAssertion; 8012 updateTypeAssertion(node: TypeAssertion, type: TypeNode, expression: Expression): TypeAssertion; 8013 createParenthesizedExpression(expression: Expression): ParenthesizedExpression; 8014 updateParenthesizedExpression(node: ParenthesizedExpression, expression: Expression): ParenthesizedExpression; 8015 createFunctionExpression(modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[] | undefined, type: TypeNode | undefined, body: Block): FunctionExpression; 8016 updateFunctionExpression(node: FunctionExpression, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block): FunctionExpression; 8017 createArrowFunction(modifiers: readonly Modifier[] | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, equalsGreaterThanToken: EqualsGreaterThanToken | undefined, body: ConciseBody): ArrowFunction; 8018 updateArrowFunction(node: ArrowFunction, modifiers: readonly Modifier[] | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, equalsGreaterThanToken: EqualsGreaterThanToken, body: ConciseBody): ArrowFunction; 8019 createEtsComponentExpression(name: Expression, argumentExpression: Expression[] | NodeArray<Expression> | undefined, body: Block | undefined): EtsComponentExpression; 8020 updateEtsComponentExpression(node: EtsComponentExpression, name: Expression | undefined, argumentExpression: Expression[] | NodeArray<Expression> | undefined, body: Block | undefined): EtsComponentExpression; 8021 createDeleteExpression(expression: Expression): DeleteExpression; 8022 updateDeleteExpression(node: DeleteExpression, expression: Expression): DeleteExpression; 8023 createTypeOfExpression(expression: Expression): TypeOfExpression; 8024 updateTypeOfExpression(node: TypeOfExpression, expression: Expression): TypeOfExpression; 8025 createVoidExpression(expression: Expression): VoidExpression; 8026 updateVoidExpression(node: VoidExpression, expression: Expression): VoidExpression; 8027 createAwaitExpression(expression: Expression): AwaitExpression; 8028 updateAwaitExpression(node: AwaitExpression, expression: Expression): AwaitExpression; 8029 createPrefixUnaryExpression(operator: PrefixUnaryOperator, operand: Expression): PrefixUnaryExpression; 8030 updatePrefixUnaryExpression(node: PrefixUnaryExpression, operand: Expression): PrefixUnaryExpression; 8031 createPostfixUnaryExpression(operand: Expression, operator: PostfixUnaryOperator): PostfixUnaryExpression; 8032 updatePostfixUnaryExpression(node: PostfixUnaryExpression, operand: Expression): PostfixUnaryExpression; 8033 createBinaryExpression(left: Expression, operator: BinaryOperator | BinaryOperatorToken, right: Expression): BinaryExpression; 8034 updateBinaryExpression(node: BinaryExpression, left: Expression, operator: BinaryOperator | BinaryOperatorToken, right: Expression): BinaryExpression; 8035 createConditionalExpression(condition: Expression, questionToken: QuestionToken | undefined, whenTrue: Expression, colonToken: ColonToken | undefined, whenFalse: Expression): ConditionalExpression; 8036 updateConditionalExpression(node: ConditionalExpression, condition: Expression, questionToken: QuestionToken, whenTrue: Expression, colonToken: ColonToken, whenFalse: Expression): ConditionalExpression; 8037 createTemplateExpression(head: TemplateHead, templateSpans: readonly TemplateSpan[]): TemplateExpression; 8038 updateTemplateExpression(node: TemplateExpression, head: TemplateHead, templateSpans: readonly TemplateSpan[]): TemplateExpression; 8039 createTemplateHead(text: string, rawText?: string, templateFlags?: TokenFlags): TemplateHead; 8040 createTemplateHead(text: string | undefined, rawText: string, templateFlags?: TokenFlags): TemplateHead; 8041 createTemplateMiddle(text: string, rawText?: string, templateFlags?: TokenFlags): TemplateMiddle; 8042 createTemplateMiddle(text: string | undefined, rawText: string, templateFlags?: TokenFlags): TemplateMiddle; 8043 createTemplateTail(text: string, rawText?: string, templateFlags?: TokenFlags): TemplateTail; 8044 createTemplateTail(text: string | undefined, rawText: string, templateFlags?: TokenFlags): TemplateTail; 8045 createNoSubstitutionTemplateLiteral(text: string, rawText?: string): NoSubstitutionTemplateLiteral; 8046 createNoSubstitutionTemplateLiteral(text: string | undefined, rawText: string): NoSubstitutionTemplateLiteral; 8047 /* @internal */ createLiteralLikeNode(kind: LiteralToken["kind"] | SyntaxKind.JsxTextAllWhiteSpaces, text: string): LiteralToken; 8048 /* @internal */ createTemplateLiteralLikeNode(kind: TemplateLiteralToken["kind"], text: string, rawText: string, templateFlags: TokenFlags | undefined): TemplateLiteralLikeNode; 8049 createYieldExpression(asteriskToken: AsteriskToken, expression: Expression): YieldExpression; 8050 createYieldExpression(asteriskToken: undefined, expression: Expression | undefined): YieldExpression; 8051 /* @internal */ createYieldExpression(asteriskToken: AsteriskToken | undefined, expression: Expression | undefined): YieldExpression; // eslint-disable-line @typescript-eslint/unified-signatures 8052 updateYieldExpression(node: YieldExpression, asteriskToken: AsteriskToken | undefined, expression: Expression | undefined): YieldExpression; 8053 createSpreadElement(expression: Expression): SpreadElement; 8054 updateSpreadElement(node: SpreadElement, expression: Expression): SpreadElement; 8055 createClassExpression(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassExpression; 8056 updateClassExpression(node: ClassExpression, modifiers: readonly ModifierLike[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassExpression; 8057 createOmittedExpression(): OmittedExpression; 8058 createExpressionWithTypeArguments(expression: Expression, typeArguments: readonly TypeNode[] | undefined): ExpressionWithTypeArguments; 8059 updateExpressionWithTypeArguments(node: ExpressionWithTypeArguments, expression: Expression, typeArguments: readonly TypeNode[] | undefined): ExpressionWithTypeArguments; 8060 createAsExpression(expression: Expression, type: TypeNode): AsExpression; 8061 updateAsExpression(node: AsExpression, expression: Expression, type: TypeNode): AsExpression; 8062 createNonNullExpression(expression: Expression): NonNullExpression; 8063 updateNonNullExpression(node: NonNullExpression, expression: Expression): NonNullExpression; 8064 createNonNullChain(expression: Expression): NonNullChain; 8065 updateNonNullChain(node: NonNullChain, expression: Expression): NonNullChain; 8066 createMetaProperty(keywordToken: MetaProperty["keywordToken"], name: Identifier): MetaProperty; 8067 updateMetaProperty(node: MetaProperty, name: Identifier): MetaProperty; 8068 createSatisfiesExpression(expression: Expression, type: TypeNode): SatisfiesExpression; 8069 updateSatisfiesExpression(node: SatisfiesExpression, expression: Expression, type: TypeNode): SatisfiesExpression; 8070 8071 // 8072 // Misc 8073 // 8074 8075 createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; 8076 updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; 8077 createSemicolonClassElement(): SemicolonClassElement; 8078 8079 // 8080 // Element 8081 // 8082 8083 createBlock(statements: readonly Statement[], multiLine?: boolean): Block; 8084 updateBlock(node: Block, statements: readonly Statement[]): Block; 8085 createVariableStatement(modifiers: readonly Modifier[] | undefined, declarationList: VariableDeclarationList | readonly VariableDeclaration[]): VariableStatement; 8086 updateVariableStatement(node: VariableStatement, modifiers: readonly Modifier[] | undefined, declarationList: VariableDeclarationList): VariableStatement; 8087 createEmptyStatement(): EmptyStatement; 8088 createExpressionStatement(expression: Expression): ExpressionStatement; 8089 updateExpressionStatement(node: ExpressionStatement, expression: Expression): ExpressionStatement; 8090 createIfStatement(expression: Expression, thenStatement: Statement, elseStatement?: Statement): IfStatement; 8091 updateIfStatement(node: IfStatement, expression: Expression, thenStatement: Statement, elseStatement: Statement | undefined): IfStatement; 8092 createDoStatement(statement: Statement, expression: Expression): DoStatement; 8093 updateDoStatement(node: DoStatement, statement: Statement, expression: Expression): DoStatement; 8094 createWhileStatement(expression: Expression, statement: Statement): WhileStatement; 8095 updateWhileStatement(node: WhileStatement, expression: Expression, statement: Statement): WhileStatement; 8096 createForStatement(initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement): ForStatement; 8097 updateForStatement(node: ForStatement, initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement): ForStatement; 8098 createForInStatement(initializer: ForInitializer, expression: Expression, statement: Statement): ForInStatement; 8099 updateForInStatement(node: ForInStatement, initializer: ForInitializer, expression: Expression, statement: Statement): ForInStatement; 8100 createForOfStatement(awaitModifier: AwaitKeyword | undefined, initializer: ForInitializer, expression: Expression, statement: Statement): ForOfStatement; 8101 updateForOfStatement(node: ForOfStatement, awaitModifier: AwaitKeyword | undefined, initializer: ForInitializer, expression: Expression, statement: Statement): ForOfStatement; 8102 createContinueStatement(label?: string | Identifier): ContinueStatement; 8103 updateContinueStatement(node: ContinueStatement, label: Identifier | undefined): ContinueStatement; 8104 createBreakStatement(label?: string | Identifier): BreakStatement; 8105 updateBreakStatement(node: BreakStatement, label: Identifier | undefined): BreakStatement; 8106 createReturnStatement(expression?: Expression): ReturnStatement; 8107 updateReturnStatement(node: ReturnStatement, expression: Expression | undefined): ReturnStatement; 8108 createWithStatement(expression: Expression, statement: Statement): WithStatement; 8109 updateWithStatement(node: WithStatement, expression: Expression, statement: Statement): WithStatement; 8110 createSwitchStatement(expression: Expression, caseBlock: CaseBlock): SwitchStatement; 8111 updateSwitchStatement(node: SwitchStatement, expression: Expression, caseBlock: CaseBlock): SwitchStatement; 8112 createLabeledStatement(label: string | Identifier, statement: Statement): LabeledStatement; 8113 updateLabeledStatement(node: LabeledStatement, label: Identifier, statement: Statement): LabeledStatement; 8114 createThrowStatement(expression: Expression): ThrowStatement; 8115 updateThrowStatement(node: ThrowStatement, expression: Expression): ThrowStatement; 8116 createTryStatement(tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined): TryStatement; 8117 updateTryStatement(node: TryStatement, tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined): TryStatement; 8118 createDebuggerStatement(): DebuggerStatement; 8119 createVariableDeclaration(name: string | BindingName, exclamationToken?: ExclamationToken, type?: TypeNode, initializer?: Expression): VariableDeclaration; 8120 updateVariableDeclaration(node: VariableDeclaration, name: BindingName, exclamationToken: ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): VariableDeclaration; 8121 createVariableDeclarationList(declarations: readonly VariableDeclaration[], flags?: NodeFlags): VariableDeclarationList; 8122 updateVariableDeclarationList(node: VariableDeclarationList, declarations: readonly VariableDeclaration[]): VariableDeclarationList; 8123 createFunctionDeclaration(modifiers: readonly ModifierLike[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; 8124 updateFunctionDeclaration(node: FunctionDeclaration, modifiers: readonly ModifierLike[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; 8125 createClassDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration; 8126 updateClassDeclaration(node: ClassDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration; 8127 createStructDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): StructDeclaration; 8128 updateStructDeclaration(node: StructDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): StructDeclaration; 8129 createInterfaceDeclaration(modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; 8130 updateInterfaceDeclaration(node: InterfaceDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; 8131 createTypeAliasDeclaration(modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; 8132 updateTypeAliasDeclaration(node: TypeAliasDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; 8133 createEnumDeclaration(modifiers: readonly Modifier[] | undefined, name: string | Identifier, members: readonly EnumMember[]): EnumDeclaration; 8134 updateEnumDeclaration(node: EnumDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, members: readonly EnumMember[]): EnumDeclaration; 8135 createModuleDeclaration(modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration; 8136 updateModuleDeclaration(node: ModuleDeclaration, modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration; 8137 createModuleBlock(statements: readonly Statement[]): ModuleBlock; 8138 updateModuleBlock(node: ModuleBlock, statements: readonly Statement[]): ModuleBlock; 8139 createCaseBlock(clauses: readonly CaseOrDefaultClause[]): CaseBlock; 8140 updateCaseBlock(node: CaseBlock, clauses: readonly CaseOrDefaultClause[]): CaseBlock; 8141 createNamespaceExportDeclaration(name: string | Identifier): NamespaceExportDeclaration; 8142 updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration; 8143 createImportEqualsDeclaration(modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; 8144 updateImportEqualsDeclaration(node: ImportEqualsDeclaration, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; 8145 createImportDeclaration(modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration; 8146 updateImportDeclaration(node: ImportDeclaration, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration; 8147 createImportClause(isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause; 8148 updateImportClause(node: ImportClause, isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause; 8149 createAssertClause(elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause; 8150 updateAssertClause(node: AssertClause, elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause; 8151 createAssertEntry(name: AssertionKey, value: Expression): AssertEntry; 8152 updateAssertEntry(node: AssertEntry, name: AssertionKey, value: Expression): AssertEntry; 8153 createImportTypeAssertionContainer(clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; 8154 updateImportTypeAssertionContainer(node: ImportTypeAssertionContainer, clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; 8155 createNamespaceImport(name: Identifier): NamespaceImport; 8156 updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport; 8157 createNamespaceExport(name: Identifier): NamespaceExport; 8158 updateNamespaceExport(node: NamespaceExport, name: Identifier): NamespaceExport; 8159 createNamedImports(elements: readonly ImportSpecifier[]): NamedImports; 8160 updateNamedImports(node: NamedImports, elements: readonly ImportSpecifier[]): NamedImports; 8161 createImportSpecifier(isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; 8162 updateImportSpecifier(node: ImportSpecifier, isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; 8163 createExportAssignment(modifiers: readonly Modifier[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment; 8164 updateExportAssignment(node: ExportAssignment, modifiers: readonly Modifier[] | undefined, expression: Expression): ExportAssignment; 8165 createExportDeclaration(modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration; 8166 updateExportDeclaration(node: ExportDeclaration, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration; 8167 createNamedExports(elements: readonly ExportSpecifier[]): NamedExports; 8168 updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports; 8169 createExportSpecifier(isTypeOnly: boolean, propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier; 8170 updateExportSpecifier(node: ExportSpecifier, isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ExportSpecifier; 8171 /* @internal*/ createMissingDeclaration(): MissingDeclaration; 8172 8173 // 8174 // Module references 8175 // 8176 8177 createExternalModuleReference(expression: Expression): ExternalModuleReference; 8178 updateExternalModuleReference(node: ExternalModuleReference, expression: Expression): ExternalModuleReference; 8179 8180 // 8181 // JSDoc 8182 // 8183 8184 createJSDocAllType(): JSDocAllType; 8185 createJSDocUnknownType(): JSDocUnknownType; 8186 createJSDocNonNullableType(type: TypeNode, postfix?: boolean): JSDocNonNullableType; 8187 updateJSDocNonNullableType(node: JSDocNonNullableType, type: TypeNode): JSDocNonNullableType; 8188 createJSDocNullableType(type: TypeNode, postfix?: boolean): JSDocNullableType; 8189 updateJSDocNullableType(node: JSDocNullableType, type: TypeNode): JSDocNullableType; 8190 createJSDocOptionalType(type: TypeNode): JSDocOptionalType; 8191 updateJSDocOptionalType(node: JSDocOptionalType, type: TypeNode): JSDocOptionalType; 8192 createJSDocFunctionType(parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): JSDocFunctionType; 8193 updateJSDocFunctionType(node: JSDocFunctionType, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): JSDocFunctionType; 8194 createJSDocVariadicType(type: TypeNode): JSDocVariadicType; 8195 updateJSDocVariadicType(node: JSDocVariadicType, type: TypeNode): JSDocVariadicType; 8196 createJSDocNamepathType(type: TypeNode): JSDocNamepathType; 8197 updateJSDocNamepathType(node: JSDocNamepathType, type: TypeNode): JSDocNamepathType; 8198 createJSDocTypeExpression(type: TypeNode): JSDocTypeExpression; 8199 updateJSDocTypeExpression(node: JSDocTypeExpression, type: TypeNode): JSDocTypeExpression; 8200 createJSDocNameReference(name: EntityName | JSDocMemberName): JSDocNameReference; 8201 updateJSDocNameReference(node: JSDocNameReference, name: EntityName | JSDocMemberName): JSDocNameReference; 8202 createJSDocMemberName(left: EntityName | JSDocMemberName, right: Identifier): JSDocMemberName; 8203 updateJSDocMemberName(node: JSDocMemberName, left: EntityName | JSDocMemberName, right: Identifier): JSDocMemberName; 8204 createJSDocLink(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLink; 8205 updateJSDocLink(node: JSDocLink, name: EntityName | JSDocMemberName | undefined, text: string): JSDocLink; 8206 createJSDocLinkCode(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkCode; 8207 updateJSDocLinkCode(node: JSDocLinkCode, name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkCode; 8208 createJSDocLinkPlain(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkPlain; 8209 updateJSDocLinkPlain(node: JSDocLinkPlain, name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkPlain; 8210 createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral; 8211 updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; 8212 createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; 8213 updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; 8214 createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray<JSDocComment>): JSDocTemplateTag; 8215 updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | NodeArray<JSDocComment> | undefined): JSDocTemplateTag; 8216 createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray<JSDocComment>): JSDocTypedefTag; 8217 updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray<JSDocComment> | undefined): JSDocTypedefTag; 8218 createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray<JSDocComment>): JSDocParameterTag; 8219 updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray<JSDocComment> | undefined): JSDocParameterTag; 8220 createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray<JSDocComment>): JSDocPropertyTag; 8221 updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray<JSDocComment> | undefined): JSDocPropertyTag; 8222 createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray<JSDocComment>): JSDocTypeTag; 8223 updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray<JSDocComment> | undefined): JSDocTypeTag; 8224 createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray<JSDocComment>): JSDocSeeTag; 8225 updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray<JSDocComment>): JSDocSeeTag; 8226 createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | NodeArray<JSDocComment>): JSDocReturnTag; 8227 updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray<JSDocComment> | undefined): JSDocReturnTag; 8228 createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray<JSDocComment>): JSDocThisTag; 8229 updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray<JSDocComment> | undefined): JSDocThisTag; 8230 createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray<JSDocComment>): JSDocEnumTag; 8231 updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray<JSDocComment> | undefined): JSDocEnumTag; 8232 createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray<JSDocComment>): JSDocCallbackTag; 8233 updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray<JSDocComment> | undefined): JSDocCallbackTag; 8234 createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | NodeArray<JSDocComment>): JSDocAugmentsTag; 8235 updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | NodeArray<JSDocComment> | undefined): JSDocAugmentsTag; 8236 createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | NodeArray<JSDocComment>): JSDocImplementsTag; 8237 updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | NodeArray<JSDocComment> | undefined): JSDocImplementsTag; 8238 createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocAuthorTag; 8239 updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | NodeArray<JSDocComment> | undefined): JSDocAuthorTag; 8240 createJSDocClassTag(tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocClassTag; 8241 updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | NodeArray<JSDocComment> | undefined): JSDocClassTag; 8242 createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocPublicTag; 8243 updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | NodeArray<JSDocComment> | undefined): JSDocPublicTag; 8244 createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocPrivateTag; 8245 updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | NodeArray<JSDocComment> | undefined): JSDocPrivateTag; 8246 createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocProtectedTag; 8247 updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | NodeArray<JSDocComment> | undefined): JSDocProtectedTag; 8248 createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocReadonlyTag; 8249 updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | NodeArray<JSDocComment> | undefined): JSDocReadonlyTag; 8250 createJSDocUnknownTag(tagName: Identifier, comment?: string | NodeArray<JSDocComment>): JSDocUnknownTag; 8251 updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | NodeArray<JSDocComment> | undefined): JSDocUnknownTag; 8252 createJSDocDeprecatedTag(tagName: Identifier, comment?: string | NodeArray<JSDocComment>): JSDocDeprecatedTag; 8253 updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | NodeArray<JSDocComment>): JSDocDeprecatedTag; 8254 createJSDocOverrideTag(tagName: Identifier, comment?: string | NodeArray<JSDocComment>): JSDocOverrideTag; 8255 updateJSDocOverrideTag(node: JSDocOverrideTag, tagName: Identifier, comment?: string | NodeArray<JSDocComment>): JSDocOverrideTag; 8256 createJSDocText(text: string): JSDocText; 8257 updateJSDocText(node: JSDocText, text: string): JSDocText; 8258 createJSDocComment(comment?: string | NodeArray<JSDocComment> | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; 8259 updateJSDocComment(node: JSDoc, comment: string | NodeArray<JSDocComment> | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; 8260 8261 // 8262 // JSX 8263 // 8264 8265 createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; 8266 updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; 8267 createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxSelfClosingElement; 8268 updateJsxSelfClosingElement(node: JsxSelfClosingElement, tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxSelfClosingElement; 8269 createJsxOpeningElement(tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxOpeningElement; 8270 updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxOpeningElement; 8271 createJsxClosingElement(tagName: JsxTagNameExpression): JsxClosingElement; 8272 updateJsxClosingElement(node: JsxClosingElement, tagName: JsxTagNameExpression): JsxClosingElement; 8273 createJsxFragment(openingFragment: JsxOpeningFragment, children: readonly JsxChild[], closingFragment: JsxClosingFragment): JsxFragment; 8274 createJsxText(text: string, containsOnlyTriviaWhiteSpaces?: boolean): JsxText; 8275 updateJsxText(node: JsxText, text: string, containsOnlyTriviaWhiteSpaces?: boolean): JsxText; 8276 createJsxOpeningFragment(): JsxOpeningFragment; 8277 createJsxJsxClosingFragment(): JsxClosingFragment; 8278 updateJsxFragment(node: JsxFragment, openingFragment: JsxOpeningFragment, children: readonly JsxChild[], closingFragment: JsxClosingFragment): JsxFragment; 8279 createJsxAttribute(name: Identifier, initializer: JsxAttributeValue | undefined): JsxAttribute; 8280 updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: JsxAttributeValue | undefined): JsxAttribute; 8281 createJsxAttributes(properties: readonly JsxAttributeLike[]): JsxAttributes; 8282 updateJsxAttributes(node: JsxAttributes, properties: readonly JsxAttributeLike[]): JsxAttributes; 8283 createJsxSpreadAttribute(expression: Expression): JsxSpreadAttribute; 8284 updateJsxSpreadAttribute(node: JsxSpreadAttribute, expression: Expression): JsxSpreadAttribute; 8285 createJsxExpression(dotDotDotToken: DotDotDotToken | undefined, expression: Expression | undefined): JsxExpression; 8286 updateJsxExpression(node: JsxExpression, expression: Expression | undefined): JsxExpression; 8287 8288 // 8289 // Clauses 8290 // 8291 8292 createCaseClause(expression: Expression, statements: readonly Statement[]): CaseClause; 8293 updateCaseClause(node: CaseClause, expression: Expression, statements: readonly Statement[]): CaseClause; 8294 createDefaultClause(statements: readonly Statement[]): DefaultClause; 8295 updateDefaultClause(node: DefaultClause, statements: readonly Statement[]): DefaultClause; 8296 createHeritageClause(token: HeritageClause["token"], types: readonly ExpressionWithTypeArguments[]): HeritageClause; 8297 updateHeritageClause(node: HeritageClause, types: readonly ExpressionWithTypeArguments[]): HeritageClause; 8298 createCatchClause(variableDeclaration: string | BindingName | VariableDeclaration | undefined, block: Block): CatchClause; 8299 updateCatchClause(node: CatchClause, variableDeclaration: VariableDeclaration | undefined, block: Block): CatchClause; 8300 8301 // 8302 // Property assignments 8303 // 8304 8305 createPropertyAssignment(name: string | PropertyName, initializer: Expression): PropertyAssignment; 8306 updatePropertyAssignment(node: PropertyAssignment, name: PropertyName, initializer: Expression): PropertyAssignment; 8307 createShorthandPropertyAssignment(name: string | Identifier, objectAssignmentInitializer?: Expression): ShorthandPropertyAssignment; 8308 updateShorthandPropertyAssignment(node: ShorthandPropertyAssignment, name: Identifier, objectAssignmentInitializer: Expression | undefined): ShorthandPropertyAssignment; 8309 createSpreadAssignment(expression: Expression): SpreadAssignment; 8310 updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment; 8311 8312 // 8313 // Enum 8314 // 8315 8316 createEnumMember(name: string | PropertyName, initializer?: Expression): EnumMember; 8317 updateEnumMember(node: EnumMember, name: PropertyName, initializer: Expression | undefined): EnumMember; 8318 8319 // 8320 // Top-level nodes 8321 // 8322 8323 createSourceFile(statements: readonly Statement[], endOfFileToken: EndOfFileToken, flags: NodeFlags): SourceFile; 8324 updateSourceFile(node: SourceFile, statements: readonly Statement[], isDeclarationFile?: boolean, referencedFiles?: readonly FileReference[], typeReferences?: readonly FileReference[], hasNoDefaultLib?: boolean, libReferences?: readonly FileReference[]): SourceFile; 8325 8326 /* @internal */ createUnparsedSource(prologues: readonly UnparsedPrologue[], syntheticReferences: readonly UnparsedSyntheticReference[] | undefined, texts: readonly UnparsedSourceText[]): UnparsedSource; 8327 /* @internal */ createUnparsedPrologue(data?: string): UnparsedPrologue; 8328 /* @internal */ createUnparsedPrepend(data: string | undefined, texts: readonly UnparsedSourceText[]): UnparsedPrepend; 8329 /* @internal */ createUnparsedTextLike(data: string | undefined, internal: boolean): UnparsedTextLike; 8330 /* @internal */ createUnparsedSyntheticReference(section: BundleFileHasNoDefaultLib | BundleFileReference): UnparsedSyntheticReference; 8331 /* @internal */ createInputFiles(): InputFiles; 8332 8333 // 8334 // Synthetic Nodes 8335 // 8336 /* @internal */ createSyntheticExpression(type: Type, isSpread?: boolean, tupleNameSource?: ParameterDeclaration | NamedTupleMember): SyntheticExpression; 8337 /* @internal */ createSyntaxList(children: Node[]): SyntaxList; 8338 8339 // 8340 // Transformation nodes 8341 // 8342 8343 createNotEmittedStatement(original: Node): NotEmittedStatement; 8344 /* @internal */ createEndOfDeclarationMarker(original: Node): EndOfDeclarationMarker; 8345 /* @internal */ createMergeDeclarationMarker(original: Node): MergeDeclarationMarker; 8346 createPartiallyEmittedExpression(expression: Expression, original?: Node): PartiallyEmittedExpression; 8347 updatePartiallyEmittedExpression(node: PartiallyEmittedExpression, expression: Expression): PartiallyEmittedExpression; 8348 /* @internal */ createSyntheticReferenceExpression(expression: Expression, thisArg: Expression): SyntheticReferenceExpression; 8349 /* @internal */ updateSyntheticReferenceExpression(node: SyntheticReferenceExpression, expression: Expression, thisArg: Expression): SyntheticReferenceExpression; 8350 createCommaListExpression(elements: readonly Expression[]): CommaListExpression; 8351 updateCommaListExpression(node: CommaListExpression, elements: readonly Expression[]): CommaListExpression; 8352 createBundle(sourceFiles: readonly SourceFile[], prepends?: readonly (UnparsedSource | InputFiles)[]): Bundle; 8353 updateBundle(node: Bundle, sourceFiles: readonly SourceFile[], prepends?: readonly (UnparsedSource | InputFiles)[]): Bundle; 8354 8355 // 8356 // Common operators 8357 // 8358 8359 createComma(left: Expression, right: Expression): BinaryExpression; 8360 createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression): DestructuringAssignment; 8361 createAssignment(left: Expression, right: Expression): AssignmentExpression<EqualsToken>; 8362 createLogicalOr(left: Expression, right: Expression): BinaryExpression; 8363 createLogicalAnd(left: Expression, right: Expression): BinaryExpression; 8364 createBitwiseOr(left: Expression, right: Expression): BinaryExpression; 8365 createBitwiseXor(left: Expression, right: Expression): BinaryExpression; 8366 createBitwiseAnd(left: Expression, right: Expression): BinaryExpression; 8367 createStrictEquality(left: Expression, right: Expression): BinaryExpression; 8368 createStrictInequality(left: Expression, right: Expression): BinaryExpression; 8369 createEquality(left: Expression, right: Expression): BinaryExpression; 8370 createInequality(left: Expression, right: Expression): BinaryExpression; 8371 createLessThan(left: Expression, right: Expression): BinaryExpression; 8372 createLessThanEquals(left: Expression, right: Expression): BinaryExpression; 8373 createGreaterThan(left: Expression, right: Expression): BinaryExpression; 8374 createGreaterThanEquals(left: Expression, right: Expression): BinaryExpression; 8375 createLeftShift(left: Expression, right: Expression): BinaryExpression; 8376 createRightShift(left: Expression, right: Expression): BinaryExpression; 8377 createUnsignedRightShift(left: Expression, right: Expression): BinaryExpression; 8378 createAdd(left: Expression, right: Expression): BinaryExpression; 8379 createSubtract(left: Expression, right: Expression): BinaryExpression; 8380 createMultiply(left: Expression, right: Expression): BinaryExpression; 8381 createDivide(left: Expression, right: Expression): BinaryExpression; 8382 createModulo(left: Expression, right: Expression): BinaryExpression; 8383 createExponent(left: Expression, right: Expression): BinaryExpression; 8384 createPrefixPlus(operand: Expression): PrefixUnaryExpression; 8385 createPrefixMinus(operand: Expression): PrefixUnaryExpression; 8386 createPrefixIncrement(operand: Expression): PrefixUnaryExpression; 8387 createPrefixDecrement(operand: Expression): PrefixUnaryExpression; 8388 createBitwiseNot(operand: Expression): PrefixUnaryExpression; 8389 createLogicalNot(operand: Expression): PrefixUnaryExpression; 8390 createPostfixIncrement(operand: Expression): PostfixUnaryExpression; 8391 createPostfixDecrement(operand: Expression): PostfixUnaryExpression; 8392 8393 // 8394 // Compound Nodes 8395 // 8396 8397 createImmediatelyInvokedFunctionExpression(statements: readonly Statement[]): CallExpression; 8398 createImmediatelyInvokedFunctionExpression(statements: readonly Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; 8399 createImmediatelyInvokedArrowFunction(statements: readonly Statement[]): CallExpression; 8400 createImmediatelyInvokedArrowFunction(statements: readonly Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; 8401 8402 8403 createVoidZero(): VoidExpression; 8404 createExportDefault(expression: Expression): ExportAssignment; 8405 createExternalModuleExport(exportName: Identifier): ExportDeclaration; 8406 8407 /* @internal */ createTypeCheck(value: Expression, tag: TypeOfTag): Expression; 8408 /* @internal */ createMethodCall(object: Expression, methodName: string | Identifier, argumentsList: readonly Expression[]): CallExpression; 8409 /* @internal */ createGlobalMethodCall(globalObjectName: string, globalMethodName: string, argumentsList: readonly Expression[]): CallExpression; 8410 /* @internal */ createFunctionBindCall(target: Expression, thisArg: Expression, argumentsList: readonly Expression[]): CallExpression; 8411 /* @internal */ createFunctionCallCall(target: Expression, thisArg: Expression, argumentsList: readonly Expression[]): CallExpression; 8412 /* @internal */ createFunctionApplyCall(target: Expression, thisArg: Expression, argumentsExpression: Expression): CallExpression; 8413 /* @internal */ createObjectDefinePropertyCall(target: Expression, propertyName: string | Expression, attributes: Expression): CallExpression; 8414 /* @internal */ createReflectGetCall(target: Expression, propertyKey: Expression, receiver?: Expression): CallExpression; 8415 /* @internal */ createReflectSetCall(target: Expression, propertyKey: Expression, value: Expression, receiver?: Expression): CallExpression; 8416 /* @internal */ createPropertyDescriptor(attributes: PropertyDescriptorAttributes, singleLine?: boolean): ObjectLiteralExpression; 8417 /* @internal */ createArraySliceCall(array: Expression, start?: number | Expression): CallExpression; 8418 /* @internal */ createArrayConcatCall(array: Expression, values: readonly Expression[]): CallExpression; 8419 /* @internal */ createCallBinding(expression: Expression, recordTempVariable: (temp: Identifier) => void, languageVersion?: ScriptTarget, cacheIdentifiers?: boolean): CallBinding; 8420 /** 8421 * Wraps an expression that cannot be an assignment target in an expression that can be. 8422 * 8423 * Given a `paramName` of `_a`: 8424 * ``` 8425 * Reflect.set(obj, "x", _a) 8426 * ``` 8427 * Becomes 8428 * ```ts 8429 * ({ set value(_a) { Reflect.set(obj, "x", _a); } }).value 8430 * ``` 8431 * 8432 * @param paramName 8433 * @param expression 8434 */ 8435 /* @internal */ createAssignmentTargetWrapper(paramName: Identifier, expression: Expression): LeftHandSideExpression; 8436 /* @internal */ inlineExpressions(expressions: readonly Expression[]): Expression; 8437 /** 8438 * Gets the internal name of a declaration. This is primarily used for declarations that can be 8439 * referred to by name in the body of an ES5 class function body. An internal name will *never* 8440 * be prefixed with an module or namespace export modifier like "exports." when emitted as an 8441 * expression. An internal name will also *never* be renamed due to a collision with a block 8442 * scoped variable. 8443 * 8444 * @param node The declaration. 8445 * @param allowComments A value indicating whether comments may be emitted for the name. 8446 * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. 8447 */ 8448 /* @internal */ getInternalName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; 8449 /** 8450 * Gets the local name of a declaration. This is primarily used for declarations that can be 8451 * referred to by name in the declaration's immediate scope (classes, enums, namespaces). A 8452 * local name will *never* be prefixed with an module or namespace export modifier like 8453 * "exports." when emitted as an expression. 8454 * 8455 * @param node The declaration. 8456 * @param allowComments A value indicating whether comments may be emitted for the name. 8457 * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. 8458 */ 8459 /* @internal */ getLocalName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; 8460 /** 8461 * Gets the export name of a declaration. This is primarily used for declarations that can be 8462 * referred to by name in the declaration's immediate scope (classes, enums, namespaces). An 8463 * export name will *always* be prefixed with a module or namespace export modifier like 8464 * `"exports."` when emitted as an expression if the name points to an exported symbol. 8465 * 8466 * @param node The declaration. 8467 * @param allowComments A value indicating whether comments may be emitted for the name. 8468 * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. 8469 */ 8470 /* @internal */ getExportName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; 8471 /** 8472 * Gets the name of a declaration for use in declarations. 8473 * 8474 * @param node The declaration. 8475 * @param allowComments A value indicating whether comments may be emitted for the name. 8476 * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. 8477 */ 8478 /* @internal */ getDeclarationName(node: Declaration | undefined, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; 8479 /** 8480 * Gets a namespace-qualified name for use in expressions. 8481 * 8482 * @param ns The namespace identifier. 8483 * @param name The name. 8484 * @param allowComments A value indicating whether comments may be emitted for the name. 8485 * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. 8486 */ 8487 /* @internal */ getNamespaceMemberName(ns: Identifier, name: Identifier, allowComments?: boolean, allowSourceMaps?: boolean): PropertyAccessExpression; 8488 /** 8489 * Gets the exported name of a declaration for use in expressions. 8490 * 8491 * An exported name will *always* be prefixed with an module or namespace export modifier like 8492 * "exports." if the name points to an exported symbol. 8493 * 8494 * @param ns The namespace identifier. 8495 * @param node The declaration. 8496 * @param allowComments A value indicating whether comments may be emitted for the name. 8497 * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. 8498 */ 8499 /* @internal */ getExternalModuleOrNamespaceExportName(ns: Identifier | undefined, node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier | PropertyAccessExpression; 8500 8501 // 8502 // Utilities 8503 // 8504 8505 restoreOuterExpressions(outerExpression: Expression | undefined, innerExpression: Expression, kinds?: OuterExpressionKinds): Expression; 8506 /* @internal */ restoreEnclosingLabel(node: Statement, outermostLabeledStatement: LabeledStatement | undefined, afterRestoreLabelCallback?: (node: LabeledStatement) => void): Statement; 8507 /* @internal */ createUseStrictPrologue(): PrologueDirective; 8508 /** 8509 * Copies any necessary standard and custom prologue-directives into target array. 8510 * @param source origin statements array 8511 * @param target result statements array 8512 * @param ensureUseStrict boolean determining whether the function need to add prologue-directives 8513 * @param visitor Optional callback used to visit any custom prologue directives. 8514 */ 8515 /* @internal */ copyPrologue(source: readonly Statement[], target: Push<Statement>, ensureUseStrict?: boolean, visitor?: (node: Node) => VisitResult<Node>): number; 8516 /** 8517 * Copies only the standard (string-expression) prologue-directives into the target statement-array. 8518 * @param source origin statements array 8519 * @param target result statements array 8520 * @param statementOffset The offset at which to begin the copy. 8521 * @param ensureUseStrict boolean determining whether the function need to add prologue-directives 8522 */ 8523 /* @internal */ copyStandardPrologue(source: readonly Statement[], target: Push<Statement>, statementOffset: number | undefined, ensureUseStrict?: boolean): number; 8524 /** 8525 * Copies only the custom prologue-directives into target statement-array. 8526 * @param source origin statements array 8527 * @param target result statements array 8528 * @param statementOffset The offset at which to begin the copy. 8529 * @param visitor Optional callback used to visit any custom prologue directives. 8530 */ 8531 /* @internal */ copyCustomPrologue(source: readonly Statement[], target: Push<Statement>, statementOffset: number, visitor?: (node: Node) => VisitResult<Node>, filter?: (node: Node) => boolean): number; 8532 /* @internal */ copyCustomPrologue(source: readonly Statement[], target: Push<Statement>, statementOffset: number | undefined, visitor?: (node: Node) => VisitResult<Node>, filter?: (node: Node) => boolean): number | undefined; 8533 /* @internal */ ensureUseStrict(statements: NodeArray<Statement>): NodeArray<Statement>; 8534 /* @internal */ liftToBlock(nodes: readonly Node[]): Statement; 8535 /** 8536 * Merges generated lexical declarations into a new statement list. 8537 */ 8538 /* @internal */ mergeLexicalEnvironment(statements: NodeArray<Statement>, declarations: readonly Statement[] | undefined): NodeArray<Statement>; 8539 /** 8540 * Appends generated lexical declarations to an array of statements. 8541 */ 8542 /* @internal */ mergeLexicalEnvironment(statements: Statement[], declarations: readonly Statement[] | undefined): Statement[]; 8543 /** 8544 * Creates a shallow, memberwise clone of a node. 8545 * - The result will have its `original` pointer set to `node`. 8546 * - The result will have its `pos` and `end` set to `-1`. 8547 * - *DO NOT USE THIS* if a more appropriate function is available. 8548 */ 8549 /* @internal */ cloneNode<T extends Node | undefined>(node: T): T; 8550 /* @internal */ updateModifiers<T extends HasModifiers>(node: T, modifiers: readonly Modifier[] | ModifierFlags | undefined): T; 8551 } 8552 8553 /* @internal */ 8554 export const enum LexicalEnvironmentFlags { 8555 None = 0, 8556 InParameters = 1 << 0, // currently visiting a parameter list 8557 VariablesHoistedInParameters = 1 << 1 // a temp variable was hoisted while visiting a parameter list 8558 } 8559 8560 export interface CoreTransformationContext { 8561 readonly factory: NodeFactory; 8562 8563 /** Gets the compiler options supplied to the transformer. */ 8564 getCompilerOptions(): CompilerOptions; 8565 8566 /** Starts a new lexical environment. */ 8567 startLexicalEnvironment(): void; 8568 8569 /* @internal */ setLexicalEnvironmentFlags(flags: LexicalEnvironmentFlags, value: boolean): void; 8570 /* @internal */ getLexicalEnvironmentFlags(): LexicalEnvironmentFlags; 8571 8572 /** Suspends the current lexical environment, usually after visiting a parameter list. */ 8573 suspendLexicalEnvironment(): void; 8574 8575 /** Resumes a suspended lexical environment, usually before visiting a function body. */ 8576 resumeLexicalEnvironment(): void; 8577 8578 /** Ends a lexical environment, returning any declarations. */ 8579 endLexicalEnvironment(): Statement[] | undefined; 8580 8581 /** Hoists a function declaration to the containing scope. */ 8582 hoistFunctionDeclaration(node: FunctionDeclaration): void; 8583 8584 /** Hoists a variable declaration to the containing scope. */ 8585 hoistVariableDeclaration(node: Identifier): void; 8586 8587 /*@internal*/ startBlockScope(): void; 8588 8589 /*@internal*/ endBlockScope(): Statement[] | undefined; 8590 8591 /*@internal*/ addBlockScopedVariable(node: Identifier): void; 8592 8593 /** Adds an initialization statement to the top of the lexical environment. */ 8594 /* @internal */ 8595 addInitializationStatement(node: Statement): void; 8596 } 8597 8598 export interface TransformationContext extends CoreTransformationContext { 8599 /*@internal*/ getEmitResolver(): EmitResolver; 8600 /*@internal*/ getEmitHost(): EmitHost; 8601 /*@internal*/ getEmitHelperFactory(): EmitHelperFactory; 8602 8603 /** Records a request for a non-scoped emit helper in the current context. */ 8604 requestEmitHelper(helper: EmitHelper): void; 8605 8606 /** Gets and resets the requested non-scoped emit helpers. */ 8607 readEmitHelpers(): EmitHelper[] | undefined; 8608 8609 /** Enables expression substitutions in the pretty printer for the provided SyntaxKind. */ 8610 enableSubstitution(kind: SyntaxKind): void; 8611 8612 /** Determines whether expression substitutions are enabled for the provided node. */ 8613 isSubstitutionEnabled(node: Node): boolean; 8614 8615 /** 8616 * Hook used by transformers to substitute expressions just before they 8617 * are emitted by the pretty printer. 8618 * 8619 * NOTE: Transformation hooks should only be modified during `Transformer` initialization, 8620 * before returning the `NodeTransformer` callback. 8621 */ 8622 onSubstituteNode: (hint: EmitHint, node: Node) => Node; 8623 8624 /** 8625 * Enables before/after emit notifications in the pretty printer for the provided 8626 * SyntaxKind. 8627 */ 8628 enableEmitNotification(kind: SyntaxKind): void; 8629 8630 /** 8631 * Determines whether before/after emit notifications should be raised in the pretty 8632 * printer when it emits a node. 8633 */ 8634 isEmitNotificationEnabled(node: Node): boolean; 8635 8636 /** 8637 * Hook used to allow transformers to capture state before or after 8638 * the printer emits a node. 8639 * 8640 * NOTE: Transformation hooks should only be modified during `Transformer` initialization, 8641 * before returning the `NodeTransformer` callback. 8642 */ 8643 onEmitNode: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void; 8644 8645 /* @internal */ addDiagnostic(diag: DiagnosticWithLocation): void; 8646 } 8647 8648 export interface TransformationResult<T extends Node> { 8649 /** Gets the transformed source files. */ 8650 transformed: T[]; 8651 8652 /** Gets diagnostics for the transformation. */ 8653 diagnostics?: DiagnosticWithLocation[]; 8654 8655 /** 8656 * Gets a substitute for a node, if one is available; otherwise, returns the original node. 8657 * 8658 * @param hint A hint as to the intended usage of the node. 8659 * @param node The node to substitute. 8660 */ 8661 substituteNode(hint: EmitHint, node: Node): Node; 8662 8663 /** 8664 * Emits a node with possible notification. 8665 * 8666 * @param hint A hint as to the intended usage of the node. 8667 * @param node The node to emit. 8668 * @param emitCallback A callback used to emit the node. 8669 */ 8670 emitNodeWithNotification(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void; 8671 8672 /** 8673 * Indicates if a given node needs an emit notification 8674 * 8675 * @param node The node to emit. 8676 */ 8677 isEmitNotificationEnabled?(node: Node): boolean; 8678 8679 /** 8680 * Clean up EmitNode entries on any parse-tree nodes. 8681 */ 8682 dispose(): void; 8683 } 8684 8685 /** 8686 * A function that is used to initialize and return a `Transformer` callback, which in turn 8687 * will be used to transform one or more nodes. 8688 */ 8689 export type TransformerFactory<T extends Node> = (context: TransformationContext) => Transformer<T>; 8690 8691 /** 8692 * A function that transforms a node. 8693 */ 8694 export type Transformer<T extends Node> = (node: T) => T; 8695 8696 /** 8697 * A function that accepts and possibly transforms a node. 8698 */ 8699 export type Visitor = (node: Node) => VisitResult<Node>; 8700 8701 export interface NodeVisitor { 8702 <T extends Node>(nodes: T, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: readonly Node[]) => T): T; 8703 <T extends Node>(nodes: T | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: readonly Node[]) => T): T | undefined; 8704 } 8705 8706 export interface NodesVisitor { 8707 <T extends Node>(nodes: NodeArray<T>, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T>; 8708 <T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T> | undefined; 8709 } 8710 8711 export type VisitResult<T extends Node> = T | readonly T[] | undefined; 8712 8713 export interface Printer { 8714 /** 8715 * Print a node and its subtree as-is, without any emit transformations. 8716 * @param hint A value indicating the purpose of a node. This is primarily used to 8717 * distinguish between an `Identifier` used in an expression position, versus an 8718 * `Identifier` used as an `IdentifierName` as part of a declaration. For most nodes you 8719 * should just pass `Unspecified`. 8720 * @param node The node to print. The node and its subtree are printed as-is, without any 8721 * emit transformations. 8722 * @param sourceFile A source file that provides context for the node. The source text of 8723 * the file is used to emit the original source content for literals and identifiers, while 8724 * the identifiers of the source file are used when generating unique names to avoid 8725 * collisions. 8726 */ 8727 printNode(hint: EmitHint, node: Node, sourceFile: SourceFile): string; 8728 /** 8729 * Prints a list of nodes using the given format flags 8730 */ 8731 printList<T extends Node>(format: ListFormat, list: NodeArray<T>, sourceFile: SourceFile): string; 8732 /** 8733 * Prints a source file as-is, without any emit transformations. 8734 */ 8735 printFile(sourceFile: SourceFile): string; 8736 /** 8737 * Prints a bundle of source files as-is, without any emit transformations. 8738 */ 8739 printBundle(bundle: Bundle): string; 8740 /*@internal*/ writeNode(hint: EmitHint, node: Node, sourceFile: SourceFile | undefined, writer: EmitTextWriter): void; 8741 /*@internal*/ writeList<T extends Node>(format: ListFormat, list: NodeArray<T> | undefined, sourceFile: SourceFile | undefined, writer: EmitTextWriter): void; 8742 writeFile(sourceFile: SourceFile, writer: EmitTextWriter, sourceMapGenerator: SourceMapGenerator | undefined): void; 8743 /*@internal*/ writeBundle(bundle: Bundle, writer: EmitTextWriter, sourceMapGenerator: SourceMapGenerator | undefined): void; 8744 /*@internal*/ bundleFileInfo?: BundleFileInfo; 8745 } 8746 8747 /*@internal*/ 8748 export const enum BundleFileSectionKind { 8749 Prologue = "prologue", 8750 EmitHelpers = "emitHelpers", 8751 NoDefaultLib = "no-default-lib", 8752 Reference = "reference", 8753 Type = "type", 8754 TypeResolutionModeRequire = "type-require", 8755 TypeResolutionModeImport = "type-import", 8756 Lib = "lib", 8757 Prepend = "prepend", 8758 Text = "text", 8759 Internal = "internal", 8760 // comments? 8761 } 8762 8763 /*@internal*/ 8764 export interface BundleFileSectionBase extends TextRange { 8765 kind: BundleFileSectionKind; 8766 data?: string; 8767 } 8768 8769 /*@internal*/ 8770 export interface BundleFilePrologue extends BundleFileSectionBase { 8771 kind: BundleFileSectionKind.Prologue; 8772 data: string; 8773 } 8774 8775 /*@internal*/ 8776 export interface BundleFileEmitHelpers extends BundleFileSectionBase { 8777 kind: BundleFileSectionKind.EmitHelpers; 8778 data: string; 8779 } 8780 8781 /*@internal*/ 8782 export interface BundleFileHasNoDefaultLib extends BundleFileSectionBase { 8783 kind: BundleFileSectionKind.NoDefaultLib; 8784 } 8785 8786 /*@internal*/ 8787 export interface BundleFileReference extends BundleFileSectionBase { 8788 kind: BundleFileSectionKind.Reference | BundleFileSectionKind.Type | BundleFileSectionKind.Lib | BundleFileSectionKind.TypeResolutionModeImport | BundleFileSectionKind.TypeResolutionModeRequire; 8789 data: string; 8790 } 8791 8792 /*@internal*/ 8793 export interface BundleFilePrepend extends BundleFileSectionBase { 8794 kind: BundleFileSectionKind.Prepend; 8795 data: string; 8796 texts: BundleFileTextLike[]; 8797 } 8798 8799 /*@internal*/ 8800 export type BundleFileTextLikeKind = BundleFileSectionKind.Text | BundleFileSectionKind.Internal; 8801 8802 /*@internal*/ 8803 export interface BundleFileTextLike extends BundleFileSectionBase { 8804 kind: BundleFileTextLikeKind; 8805 } 8806 8807 /*@internal*/ 8808 export type BundleFileSection = 8809 BundleFilePrologue 8810 | BundleFileEmitHelpers 8811 | BundleFileHasNoDefaultLib 8812 | BundleFileReference 8813 | BundleFilePrepend 8814 | BundleFileTextLike; 8815 8816 /*@internal*/ 8817 export interface SourceFilePrologueDirectiveExpression extends TextRange { 8818 text: string; 8819 } 8820 8821 /*@internal*/ 8822 export interface SourceFilePrologueDirective extends TextRange { 8823 expression: SourceFilePrologueDirectiveExpression; 8824 } 8825 8826 /*@internal*/ 8827 export interface SourceFilePrologueInfo { 8828 file: number; 8829 text: string; 8830 directives: SourceFilePrologueDirective[]; 8831 } 8832 8833 /*@internal*/ 8834 export interface SourceFileInfo { 8835 // List of helpers in own source files emitted if no prepend is present 8836 helpers?: string[]; 8837 prologues?: SourceFilePrologueInfo[]; 8838 } 8839 8840 /*@internal*/ 8841 export interface BundleFileInfo { 8842 sections: BundleFileSection[]; 8843 hash?: string; 8844 mapHash?: string; 8845 sources?: SourceFileInfo; 8846 } 8847 8848 /*@internal*/ 8849 export interface BundleBuildInfo { 8850 js?: BundleFileInfo; 8851 dts?: BundleFileInfo; 8852 commonSourceDirectory: string; 8853 sourceFiles: readonly string[]; 8854 } 8855 8856 /* @internal */ 8857 export interface BuildInfo { 8858 bundle?: BundleBuildInfo; 8859 program?: ProgramBuildInfo; 8860 version: string; 8861 } 8862 8863 export interface PrintHandlers { 8864 /** 8865 * A hook used by the Printer when generating unique names to avoid collisions with 8866 * globally defined names that exist outside of the current source file. 8867 */ 8868 hasGlobalName?(name: string): boolean; 8869 /** 8870 * A hook used by the Printer to provide notifications prior to emitting a node. A 8871 * compatible implementation **must** invoke `emitCallback` with the provided `hint` and 8872 * `node` values. 8873 * @param hint A hint indicating the intended purpose of the node. 8874 * @param node The node to emit. 8875 * @param emitCallback A callback that, when invoked, will emit the node. 8876 * @example 8877 * ```ts 8878 * var printer = createPrinter(printerOptions, { 8879 * onEmitNode(hint, node, emitCallback) { 8880 * // set up or track state prior to emitting the node... 8881 * emitCallback(hint, node); 8882 * // restore state after emitting the node... 8883 * } 8884 * }); 8885 * ``` 8886 */ 8887 onEmitNode?(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void; 8888 8889 /** 8890 * A hook used to check if an emit notification is required for a node. 8891 * @param node The node to emit. 8892 */ 8893 isEmitNotificationEnabled?(node: Node): boolean; 8894 /** 8895 * A hook used by the Printer to perform just-in-time substitution of a node. This is 8896 * primarily used by node transformations that need to substitute one node for another, 8897 * such as replacing `myExportedVar` with `exports.myExportedVar`. 8898 * @param hint A hint indicating the intended purpose of the node. 8899 * @param node The node to emit. 8900 * @example 8901 * ```ts 8902 * var printer = createPrinter(printerOptions, { 8903 * substituteNode(hint, node) { 8904 * // perform substitution if necessary... 8905 * return node; 8906 * } 8907 * }); 8908 * ``` 8909 */ 8910 substituteNode?(hint: EmitHint, node: Node): Node; 8911 /*@internal*/ onEmitSourceMapOfNode?: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void; 8912 /*@internal*/ onEmitSourceMapOfToken?: (node: Node | undefined, token: SyntaxKind, writer: (s: string) => void, pos: number, emitCallback: (token: SyntaxKind, writer: (s: string) => void, pos: number) => number) => number; 8913 /*@internal*/ onEmitSourceMapOfPosition?: (pos: number) => void; 8914 /*@internal*/ onSetSourceFile?: (node: SourceFile) => void; 8915 /*@internal*/ onBeforeEmitNode?: (node: Node | undefined) => void; 8916 /*@internal*/ onAfterEmitNode?: (node: Node | undefined) => void; 8917 /*@internal*/ onBeforeEmitNodeArray?: (nodes: NodeArray<any> | undefined) => void; 8918 /*@internal*/ onAfterEmitNodeArray?: (nodes: NodeArray<any> | undefined) => void; 8919 /*@internal*/ onBeforeEmitToken?: (node: Node) => void; 8920 /*@internal*/ onAfterEmitToken?: (node: Node) => void; 8921 } 8922 8923 export interface PrinterOptions { 8924 removeComments?: boolean; 8925 newLine?: NewLineKind; 8926 omitTrailingSemicolon?: boolean; 8927 noEmitHelpers?: boolean; 8928 /*@internal*/ module?: CompilerOptions["module"]; 8929 /*@internal*/ target?: CompilerOptions["target"]; 8930 sourceMap?: boolean; 8931 inlineSourceMap?: boolean; 8932 inlineSources?: boolean; 8933 /*@internal*/ extendedDiagnostics?: boolean; 8934 /*@internal*/ onlyPrintJsDocStyle?: boolean; 8935 /*@internal*/ neverAsciiEscape?: boolean; 8936 /*@internal*/ writeBundleFileInfo?: boolean; 8937 /*@internal*/ recordInternalSection?: boolean; 8938 /*@internal*/ stripInternal?: boolean; 8939 /*@internal*/ preserveSourceNewlines?: boolean; 8940 /*@internal*/ terminateUnterminatedLiterals?: boolean; 8941 /*@internal*/ relativeToBuildInfo?: (path: string) => string; 8942 } 8943 8944 export interface RawSourceMap { 8945 version: 3; 8946 file: string; 8947 sourceRoot?: string | null; 8948 sources: string[]; 8949 sourcesContent?: (string | null)[] | null; 8950 mappings: string; 8951 names?: string[] | null; 8952 } 8953 8954 /** 8955 * Generates a source map. 8956 */ 8957 export interface SourceMapGenerator { 8958 getSources(): readonly string[]; 8959 /** 8960 * Adds a source to the source map. 8961 */ 8962 addSource(fileName: string): number; 8963 /** 8964 * Set the content for a source. 8965 */ 8966 setSourceContent(sourceIndex: number, content: string | null): void; 8967 /** 8968 * Adds a name. 8969 */ 8970 addName(name: string): number; 8971 /** 8972 * Adds a mapping without source information. 8973 */ 8974 addMapping(generatedLine: number, generatedCharacter: number): void; 8975 /** 8976 * Adds a mapping with source information. 8977 */ 8978 addMapping(generatedLine: number, generatedCharacter: number, sourceIndex: number, sourceLine: number, sourceCharacter: number, nameIndex?: number): void; 8979 /** 8980 * Appends a source map. 8981 */ 8982 appendSourceMap(generatedLine: number, generatedCharacter: number, sourceMap: RawSourceMap, sourceMapPath: string, start?: LineAndCharacter, end?: LineAndCharacter): void; 8983 /** 8984 * Gets the source map as a `RawSourceMap` object. 8985 */ 8986 toJSON(): RawSourceMap; 8987 /** 8988 * Gets the string representation of the source map. 8989 */ 8990 toString(): string; 8991 } 8992 8993 /* @internal */ 8994 export interface DocumentPositionMapperHost { 8995 getSourceFileLike(fileName: string): SourceFileLike | undefined; 8996 getCanonicalFileName(path: string): string; 8997 log(text: string): void; 8998 } 8999 9000 /** 9001 * Maps positions between source and generated files. 9002 */ 9003 /* @internal */ 9004 export interface DocumentPositionMapper { 9005 getSourcePosition(input: DocumentPosition): DocumentPosition; 9006 getGeneratedPosition(input: DocumentPosition): DocumentPosition; 9007 } 9008 9009 /* @internal */ 9010 export interface DocumentPosition { 9011 fileName: string; 9012 pos: number; 9013 } 9014 9015 export interface EmitTextWriter extends SymbolWriter { 9016 write(s: string): void; 9017 writeTrailingSemicolon(text: string): void; 9018 writeComment(text: string): void; 9019 getText(): string; 9020 rawWrite(s: string): void; 9021 writeLiteral(s: string): void; 9022 getTextPos(): number; 9023 getLine(): number; 9024 getColumn(): number; 9025 getIndent(): number; 9026 isAtStartOfLine(): boolean; 9027 hasTrailingComment(): boolean; 9028 hasTrailingWhitespace(): boolean; 9029 getTextPosWithWriteLine?(): number; 9030 nonEscapingWrite?(text: string): void; 9031 } 9032 9033 export interface GetEffectiveTypeRootsHost { 9034 directoryExists?(directoryName: string): boolean; 9035 getCurrentDirectory?(): string; 9036 } 9037 9038 /* @internal */ 9039 export interface HasCurrentDirectory { 9040 getCurrentDirectory(): string; 9041 } 9042 9043 export interface ModuleSpecifierResolutionHost { 9044 useCaseSensitiveFileNames?(): boolean; 9045 fileExists(path: string): boolean; 9046 getCurrentDirectory(): string; 9047 directoryExists?(path: string): boolean; 9048 readFile?(path: string): string | undefined; 9049 realpath?(path: string): string; 9050 /* @internal */ 9051 getSymlinkCache?(): SymlinkCache; 9052 getModuleSpecifierCache?(): ModuleSpecifierCache; 9053 getPackageJsonInfoCache?(): PackageJsonInfoCache | undefined; 9054 getGlobalTypingsCacheLocation?(): string | undefined; 9055 getNearestAncestorDirectoryWithPackageJson?(fileName: string, rootDir?: string): string | undefined; 9056 9057 readonly redirectTargetsMap: RedirectTargetsMap; 9058 getProjectReferenceRedirect(fileName: string): string | undefined; 9059 isSourceOfProjectReferenceRedirect(fileName: string): boolean; 9060 /* @internal */ 9061 getFileIncludeReasons(): MultiMap<Path, FileIncludeReason>; 9062 } 9063 9064 export interface ModulePath { 9065 path: string; 9066 isInNodeModules: boolean; 9067 isRedirect: boolean; 9068 } 9069 9070 export interface ResolvedModuleSpecifierInfo { 9071 modulePaths: readonly ModulePath[] | undefined; 9072 moduleSpecifiers: readonly string[] | undefined; 9073 isBlockedByPackageJsonDependencies: boolean | undefined; 9074 } 9075 9076 export interface ModuleSpecifierOptions { 9077 overrideImportMode?: SourceFile["impliedNodeFormat"]; 9078 } 9079 9080 export interface ModuleSpecifierCache { 9081 get(fromFileName: Path, toFileName: Path, preferences: UserPreferences, options: ModuleSpecifierOptions): Readonly<ResolvedModuleSpecifierInfo> | undefined; 9082 set(fromFileName: Path, toFileName: Path, preferences: UserPreferences, options: ModuleSpecifierOptions, modulePaths: readonly ModulePath[], moduleSpecifiers: readonly string[]): void; 9083 setBlockedByPackageJsonDependencies(fromFileName: Path, toFileName: Path, preferences: UserPreferences, options: ModuleSpecifierOptions, isBlockedByPackageJsonDependencies: boolean): void; 9084 setModulePaths(fromFileName: Path, toFileName: Path, preferences: UserPreferences, options: ModuleSpecifierOptions, modulePaths: readonly ModulePath[]): void; 9085 clear(): void; 9086 count(): number; 9087 } 9088 9089 // Note: this used to be deprecated in our public API, but is still used internally 9090 export interface SymbolTracker { 9091 // Called when the symbol writer encounters a symbol to write. Currently only used by the 9092 // declaration emitter to help determine if it should patch up the final declaration file 9093 // with import statements it previously saw (but chose not to emit). 9094 trackSymbol?(symbol: Symbol, enclosingDeclaration: Node | undefined, meaning: SymbolFlags): boolean; 9095 reportInaccessibleThisError?(): void; 9096 reportPrivateInBaseOfClassExpression?(propertyName: string): void; 9097 reportInaccessibleUniqueSymbolError?(): void; 9098 reportCyclicStructureError?(): void; 9099 reportLikelyUnsafeImportRequiredError?(specifier: string): void; 9100 reportTruncationError?(): void; 9101 moduleResolverHost?: ModuleSpecifierResolutionHost & { getCommonSourceDirectory(): string }; 9102 trackReferencedAmbientModule?(decl: ModuleDeclaration, symbol: Symbol): void; 9103 trackExternalModuleSymbolOfImportTypeNode?(symbol: Symbol): void; 9104 reportNonlocalAugmentation?(containingFile: SourceFile, parentSymbol: Symbol, augmentingSymbol: Symbol): void; 9105 reportNonSerializableProperty?(propertyName: string): void; 9106 reportImportTypeNodeResolutionModeOverride?(): void; 9107 } 9108 9109 export interface TextSpan { 9110 start: number; 9111 length: number; 9112 } 9113 9114 export interface TextChangeRange { 9115 span: TextSpan; 9116 newLength: number; 9117 } 9118 9119 /* @internal */ 9120 export interface DiagnosticCollection { 9121 // Adds a diagnostic to this diagnostic collection. 9122 add(diagnostic: Diagnostic): void; 9123 9124 // Returns the first existing diagnostic that is equivalent to the given one (sans related information) 9125 lookup(diagnostic: Diagnostic): Diagnostic | undefined; 9126 9127 // Gets all the diagnostics that aren't associated with a file. 9128 getGlobalDiagnostics(): Diagnostic[]; 9129 9130 // If fileName is provided, gets all the diagnostics associated with that file name. 9131 // Otherwise, returns all the diagnostics (global and file associated) in this collection. 9132 getDiagnostics(): Diagnostic[]; 9133 getDiagnostics(fileName: string): DiagnosticWithLocation[]; 9134 } 9135 9136 // SyntaxKind.SyntaxList 9137 export interface SyntaxList extends Node { 9138 kind: SyntaxKind.SyntaxList; 9139 _children: Node[]; 9140 } 9141 9142 export const enum ListFormat { 9143 None = 0, 9144 9145 // Line separators 9146 SingleLine = 0, // Prints the list on a single line (default). 9147 MultiLine = 1 << 0, // Prints the list on multiple lines. 9148 PreserveLines = 1 << 1, // Prints the list using line preservation if possible. 9149 LinesMask = SingleLine | MultiLine | PreserveLines, 9150 9151 // Delimiters 9152 NotDelimited = 0, // There is no delimiter between list items (default). 9153 BarDelimited = 1 << 2, // Each list item is space-and-bar (" |") delimited. 9154 AmpersandDelimited = 1 << 3, // Each list item is space-and-ampersand (" &") delimited. 9155 CommaDelimited = 1 << 4, // Each list item is comma (",") delimited. 9156 AsteriskDelimited = 1 << 5, // Each list item is asterisk ("\n *") delimited, used with JSDoc. 9157 DelimitersMask = BarDelimited | AmpersandDelimited | CommaDelimited | AsteriskDelimited, 9158 9159 AllowTrailingComma = 1 << 6, // Write a trailing comma (",") if present. 9160 9161 // Whitespace 9162 Indented = 1 << 7, // The list should be indented. 9163 SpaceBetweenBraces = 1 << 8, // Inserts a space after the opening brace and before the closing brace. 9164 SpaceBetweenSiblings = 1 << 9, // Inserts a space between each sibling node. 9165 9166 // Brackets/Braces 9167 Braces = 1 << 10, // The list is surrounded by "{" and "}". 9168 Parenthesis = 1 << 11, // The list is surrounded by "(" and ")". 9169 AngleBrackets = 1 << 12, // The list is surrounded by "<" and ">". 9170 SquareBrackets = 1 << 13, // The list is surrounded by "[" and "]". 9171 BracketsMask = Braces | Parenthesis | AngleBrackets | SquareBrackets, 9172 9173 OptionalIfUndefined = 1 << 14, // Do not emit brackets if the list is undefined. 9174 OptionalIfEmpty = 1 << 15, // Do not emit brackets if the list is empty. 9175 Optional = OptionalIfUndefined | OptionalIfEmpty, 9176 9177 // Other 9178 PreferNewLine = 1 << 16, // Prefer adding a LineTerminator between synthesized nodes. 9179 NoTrailingNewLine = 1 << 17, // Do not emit a trailing NewLine for a MultiLine list. 9180 NoInterveningComments = 1 << 18, // Do not emit comments between each node 9181 NoSpaceIfEmpty = 1 << 19, // If the literal is empty, do not add spaces between braces. 9182 SingleElement = 1 << 20, 9183 SpaceAfterList = 1 << 21, // Add space after list 9184 9185 // Precomputed Formats 9186 Modifiers = SingleLine | SpaceBetweenSiblings | NoInterveningComments | SpaceAfterList, 9187 HeritageClauses = SingleLine | SpaceBetweenSiblings, 9188 SingleLineTypeLiteralMembers = SingleLine | SpaceBetweenBraces | SpaceBetweenSiblings, 9189 MultiLineTypeLiteralMembers = MultiLine | Indented | OptionalIfEmpty, 9190 9191 SingleLineTupleTypeElements = CommaDelimited | SpaceBetweenSiblings | SingleLine, 9192 MultiLineTupleTypeElements = CommaDelimited | Indented | SpaceBetweenSiblings | MultiLine, 9193 UnionTypeConstituents = BarDelimited | SpaceBetweenSiblings | SingleLine, 9194 IntersectionTypeConstituents = AmpersandDelimited | SpaceBetweenSiblings | SingleLine, 9195 ObjectBindingPatternElements = SingleLine | AllowTrailingComma | SpaceBetweenBraces | CommaDelimited | SpaceBetweenSiblings | NoSpaceIfEmpty, 9196 ArrayBindingPatternElements = SingleLine | AllowTrailingComma | CommaDelimited | SpaceBetweenSiblings | NoSpaceIfEmpty, 9197 ObjectLiteralExpressionProperties = PreserveLines | CommaDelimited | SpaceBetweenSiblings | SpaceBetweenBraces | Indented | Braces | NoSpaceIfEmpty, 9198 ImportClauseEntries = PreserveLines | CommaDelimited | SpaceBetweenSiblings | SpaceBetweenBraces | Indented | Braces | NoSpaceIfEmpty, 9199 ArrayLiteralExpressionElements = PreserveLines | CommaDelimited | SpaceBetweenSiblings | AllowTrailingComma | Indented | SquareBrackets, 9200 CommaListElements = CommaDelimited | SpaceBetweenSiblings | SingleLine, 9201 CallExpressionArguments = CommaDelimited | SpaceBetweenSiblings | SingleLine | Parenthesis, 9202 NewExpressionArguments = CommaDelimited | SpaceBetweenSiblings | SingleLine | Parenthesis | OptionalIfUndefined, 9203 TemplateExpressionSpans = SingleLine | NoInterveningComments, 9204 SingleLineBlockStatements = SpaceBetweenBraces | SpaceBetweenSiblings | SingleLine, 9205 MultiLineBlockStatements = Indented | MultiLine, 9206 VariableDeclarationList = CommaDelimited | SpaceBetweenSiblings | SingleLine, 9207 SingleLineFunctionBodyStatements = SingleLine | SpaceBetweenSiblings | SpaceBetweenBraces, 9208 MultiLineFunctionBodyStatements = MultiLine, 9209 ClassHeritageClauses = SingleLine, 9210 ClassMembers = Indented | MultiLine, 9211 InterfaceMembers = Indented | MultiLine, 9212 EnumMembers = CommaDelimited | Indented | MultiLine, 9213 CaseBlockClauses = Indented | MultiLine, 9214 NamedImportsOrExportsElements = CommaDelimited | SpaceBetweenSiblings | AllowTrailingComma | SingleLine | SpaceBetweenBraces | NoSpaceIfEmpty, 9215 JsxElementOrFragmentChildren = SingleLine | NoInterveningComments, 9216 JsxElementAttributes = SingleLine | SpaceBetweenSiblings | NoInterveningComments, 9217 CaseOrDefaultClauseStatements = Indented | MultiLine | NoTrailingNewLine | OptionalIfEmpty, 9218 HeritageClauseTypes = CommaDelimited | SpaceBetweenSiblings | SingleLine, 9219 SourceFileStatements = MultiLine | NoTrailingNewLine, 9220 Decorators = MultiLine | Optional | SpaceAfterList, 9221 TypeArguments = CommaDelimited | SpaceBetweenSiblings | SingleLine | AngleBrackets | Optional, 9222 TypeParameters = CommaDelimited | SpaceBetweenSiblings | SingleLine | AngleBrackets | Optional, 9223 Parameters = CommaDelimited | SpaceBetweenSiblings | SingleLine | Parenthesis, 9224 IndexSignatureParameters = CommaDelimited | SpaceBetweenSiblings | SingleLine | Indented | SquareBrackets, 9225 JSDocComment = MultiLine | AsteriskDelimited, 9226 } 9227 9228 /* @internal */ 9229 export const enum PragmaKindFlags { 9230 None = 0, 9231 /** 9232 * Triple slash comment of the form 9233 * /// <pragma-name argname="value" /> 9234 */ 9235 TripleSlashXML = 1 << 0, 9236 /** 9237 * Single line comment of the form 9238 * // @pragma-name argval1 argval2 9239 * or 9240 * /// @pragma-name argval1 argval2 9241 */ 9242 SingleLine = 1 << 1, 9243 /** 9244 * Multiline non-jsdoc pragma of the form 9245 * /* @pragma-name argval1 argval2 * / 9246 */ 9247 MultiLine = 1 << 2, 9248 All = TripleSlashXML | SingleLine | MultiLine, 9249 Default = All, 9250 } 9251 9252 /* @internal */ 9253 interface PragmaArgumentSpecification<TName extends string> { 9254 name: TName; // Determines the name of the key in the resulting parsed type, type parameter to cause literal type inference 9255 optional?: boolean; 9256 captureSpan?: boolean; 9257 } 9258 9259 /* @internal */ 9260 export interface PragmaDefinition<T1 extends string = string, T2 extends string = string, T3 extends string = string, T4 extends string = string> { 9261 args?: 9262 | readonly [PragmaArgumentSpecification<T1>] 9263 | readonly [PragmaArgumentSpecification<T1>, PragmaArgumentSpecification<T2>] 9264 | readonly [PragmaArgumentSpecification<T1>, PragmaArgumentSpecification<T2>, PragmaArgumentSpecification<T3>] 9265 | readonly [PragmaArgumentSpecification<T1>, PragmaArgumentSpecification<T2>, PragmaArgumentSpecification<T3>, PragmaArgumentSpecification<T4>]; 9266 // If not present, defaults to PragmaKindFlags.Default 9267 kind?: PragmaKindFlags; 9268 } 9269 9270 // While not strictly a type, this is here because `PragmaMap` needs to be here to be used with `SourceFile`, and we don't 9271 // fancy effectively defining it twice, once in value-space and once in type-space 9272 /* @internal */ 9273 export const commentPragmas = { 9274 "reference": { 9275 args: [ 9276 { name: "types", optional: true, captureSpan: true }, 9277 { name: "lib", optional: true, captureSpan: true }, 9278 { name: "path", optional: true, captureSpan: true }, 9279 { name: "no-default-lib", optional: true }, 9280 { name: "resolution-mode", optional: true } 9281 ], 9282 kind: PragmaKindFlags.TripleSlashXML 9283 }, 9284 "amd-dependency": { 9285 args: [{ name: "path" }, { name: "name", optional: true }], 9286 kind: PragmaKindFlags.TripleSlashXML 9287 }, 9288 "amd-module": { 9289 args: [{ name: "name" }], 9290 kind: PragmaKindFlags.TripleSlashXML 9291 }, 9292 "ts-check": { 9293 kind: PragmaKindFlags.SingleLine 9294 }, 9295 "ts-nocheck": { 9296 kind: PragmaKindFlags.SingleLine 9297 }, 9298 "jsx": { 9299 args: [{ name: "factory" }], 9300 kind: PragmaKindFlags.MultiLine 9301 }, 9302 "jsxfrag": { 9303 args: [{ name: "factory" }], 9304 kind: PragmaKindFlags.MultiLine 9305 }, 9306 "jsximportsource": { 9307 args: [{ name: "factory" }], 9308 kind: PragmaKindFlags.MultiLine 9309 }, 9310 "jsxruntime": { 9311 args: [{ name: "factory" }], 9312 kind: PragmaKindFlags.MultiLine 9313 }, 9314 } as const; 9315 9316 /* @internal */ 9317 type PragmaArgTypeMaybeCapture<TDesc> = TDesc extends {captureSpan: true} ? {value: string, pos: number, end: number} : string; 9318 9319 /* @internal */ 9320 type PragmaArgTypeOptional<TDesc, TName extends string> = 9321 TDesc extends {optional: true} 9322 ? {[K in TName]?: PragmaArgTypeMaybeCapture<TDesc>} 9323 : {[K in TName]: PragmaArgTypeMaybeCapture<TDesc>}; 9324 9325 /* @internal */ 9326 type UnionToIntersection<U> = 9327 (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never; 9328 9329 /* @internal */ 9330 type ArgumentDefinitionToFieldUnion<T extends readonly PragmaArgumentSpecification<any>[]> = { 9331 [K in keyof T]: PragmaArgTypeOptional<T[K], T[K] extends {name: infer TName} ? TName extends string ? TName : never : never> 9332 }[Extract<keyof T, number>]; // The mapped type maps over only the tuple members, but this reindex gets _all_ members - by extracting only `number` keys, we get only the tuple members 9333 9334 /** 9335 * Maps a pragma definition into the desired shape for its arguments object 9336 */ 9337 /* @internal */ 9338 type PragmaArgumentType<KPrag extends keyof ConcretePragmaSpecs> = 9339 ConcretePragmaSpecs[KPrag] extends { args: readonly PragmaArgumentSpecification<any>[] } 9340 ? UnionToIntersection<ArgumentDefinitionToFieldUnion<ConcretePragmaSpecs[KPrag]["args"]>> 9341 : never; 9342 9343 /* @internal */ 9344 type ConcretePragmaSpecs = typeof commentPragmas; 9345 9346 /* @internal */ 9347 export type PragmaPseudoMap = {[K in keyof ConcretePragmaSpecs]: {arguments: PragmaArgumentType<K>, range: CommentRange}}; 9348 9349 /* @internal */ 9350 export type PragmaPseudoMapEntry = {[K in keyof PragmaPseudoMap]: {name: K, args: PragmaPseudoMap[K]}}[keyof PragmaPseudoMap]; 9351 9352 /* @internal */ 9353 export interface ReadonlyPragmaMap extends ReadonlyESMap<string, PragmaPseudoMap[keyof PragmaPseudoMap] | PragmaPseudoMap[keyof PragmaPseudoMap][]> { 9354 get<TKey extends keyof PragmaPseudoMap>(key: TKey): PragmaPseudoMap[TKey] | PragmaPseudoMap[TKey][]; 9355 forEach(action: <TKey extends keyof PragmaPseudoMap>(value: PragmaPseudoMap[TKey] | PragmaPseudoMap[TKey][], key: TKey) => void): void; 9356 } 9357 9358 /** 9359 * A strongly-typed es6 map of pragma entries, the values of which are either a single argument 9360 * value (if only one was found), or an array of multiple argument values if the pragma is present 9361 * in multiple places 9362 */ 9363 /* @internal */ 9364 export interface PragmaMap extends ESMap<string, PragmaPseudoMap[keyof PragmaPseudoMap] | PragmaPseudoMap[keyof PragmaPseudoMap][]>, ReadonlyPragmaMap { 9365 set<TKey extends keyof PragmaPseudoMap>(key: TKey, value: PragmaPseudoMap[TKey] | PragmaPseudoMap[TKey][]): this; 9366 get<TKey extends keyof PragmaPseudoMap>(key: TKey): PragmaPseudoMap[TKey] | PragmaPseudoMap[TKey][]; 9367 forEach(action: <TKey extends keyof PragmaPseudoMap>(value: PragmaPseudoMap[TKey] | PragmaPseudoMap[TKey][], key: TKey) => void): void; 9368 } 9369 9370 /* @internal */ 9371 export interface CommentDirectivesMap { 9372 getUnusedExpectations(): CommentDirective[]; 9373 markUsed(matchedLine: number): boolean; 9374 } 9375 9376 export interface UserPreferences { 9377 readonly disableSuggestions?: boolean; 9378 readonly quotePreference?: "auto" | "double" | "single"; 9379 readonly includeCompletionsForModuleExports?: boolean; 9380 readonly includeCompletionsForImportStatements?: boolean; 9381 readonly includeCompletionsWithSnippetText?: boolean; 9382 readonly includeAutomaticOptionalChainCompletions?: boolean; 9383 readonly includeCompletionsWithInsertText?: boolean; 9384 readonly includeCompletionsWithClassMemberSnippets?: boolean; 9385 readonly includeCompletionsWithObjectLiteralMethodSnippets?: boolean; 9386 readonly useLabelDetailsInCompletionEntries?: boolean; 9387 readonly allowIncompleteCompletions?: boolean; 9388 readonly importModuleSpecifierPreference?: "shortest" | "project-relative" | "relative" | "non-relative"; 9389 /** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */ 9390 readonly importModuleSpecifierEnding?: "auto" | "minimal" | "index" | "js"; 9391 readonly allowTextChangesInNewFiles?: boolean; 9392 readonly providePrefixAndSuffixTextForRename?: boolean; 9393 readonly includePackageJsonAutoImports?: "auto" | "on" | "off"; 9394 readonly provideRefactorNotApplicableReason?: boolean; 9395 readonly jsxAttributeCompletionStyle?: "auto" | "braces" | "none"; 9396 readonly includeInlayParameterNameHints?: "none" | "literals" | "all"; 9397 readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean; 9398 readonly includeInlayFunctionParameterTypeHints?: boolean, 9399 readonly includeInlayVariableTypeHints?: boolean; 9400 readonly includeInlayVariableTypeHintsWhenTypeMatchesName?: boolean; 9401 readonly includeInlayPropertyDeclarationTypeHints?: boolean; 9402 readonly includeInlayFunctionLikeReturnTypeHints?: boolean; 9403 readonly includeInlayEnumMemberValueHints?: boolean; 9404 readonly allowRenameOfImportPath?: boolean; 9405 readonly autoImportFileExcludePatterns?: string[]; 9406 } 9407 9408 /** Represents a bigint literal value without requiring bigint support */ 9409 export interface PseudoBigInt { 9410 negative: boolean; 9411 base10Value: string; 9412 } 9413 9414 /* @internal */ 9415 export interface Queue<T> { 9416 enqueue(...items: T[]): void; 9417 dequeue(): T; 9418 isEmpty(): boolean; 9419 } 9420} 9421