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