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