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