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