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