FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TypeScript/src/compiler/types.ts at asyncGeneratorsUpLevel · UmeshP53/TypeScript · GitHub
TypeScript/src/compiler/types.ts at asyncGeneratorsUpLevel · UmeshP53/TypeScript · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
UmeshP53
/
TypeScript
Public
forked from
microsoft/TypeScript
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
TypeScript
/
src
/
compiler
/
types.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
3646 lines (3151 loc) · 150 KB
Breadcrumbs
TypeScript
/
src
/
compiler
/
types.ts
Copy path
File metadata and controls
3646 lines (3151 loc) · 150 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
namespace
ts
{
export
interface
MapLike
<
T
>
{
[
index
:
string
]
:
T
;
}
export
interface
Map
<
T
>
extends
MapLike
<
T
>
{
__mapBrand
:
any
;
}
// branded string type used to store absolute, normalized and canonicalized paths
// arbitrary file name can be converted to Path via toPath function
export
type
Path
=
string
&
{
__pathBrand
:
any
}
;
export
interface
FileMap
<
T
>
{
get
(
fileName
:
Path
)
:
T
;
set
(
fileName
:
Path
,
value
:
T
)
:
void
;
contains
(
fileName
:
Path
)
:
boolean
;
remove
(
fileName
:
Path
)
:
void
;
forEachValue
(
f
:
(
key
:
Path
,
v
:
T
)
=>
void
)
:
void
;
getKeys
(
)
:
Path
[
]
;
clear
(
)
:
void
;
}
export
interface
TextRange
{
pos
:
number
;
end
:
number
;
}
// token > SyntaxKind.Identifer => token is a keyword
// Also, If you add a new SyntaxKind be sure to keep the `Markers` section at the bottom in sync
export
const
enum
SyntaxKind
{
Unknown
,
EndOfFileToken
,
SingleLineCommentTrivia
,
MultiLineCommentTrivia
,
NewLineTrivia
,
WhitespaceTrivia
,
// We detect and preserve #! on the first line
ShebangTrivia
,
// We detect and provide better error recovery when we encounter a git merge marker. This
// allows us to edit files with git-conflict markers in them in a much more pleasant manner.
ConflictMarkerTrivia
,
// Literals
NumericLiteral
,
StringLiteral
,
JsxText
,
RegularExpressionLiteral
,
NoSubstitutionTemplateLiteral
,
// Pseudo-literals
TemplateHead
,
TemplateMiddle
,
TemplateTail
,
// Punctuation
OpenBraceToken
,
CloseBraceToken
,
OpenParenToken
,
CloseParenToken
,
OpenBracketToken
,
CloseBracketToken
,
DotToken
,
DotDotDotToken
,
SemicolonToken
,
CommaToken
,
LessThanToken
,
LessThanSlashToken
,
GreaterThanToken
,
LessThanEqualsToken
,
GreaterThanEqualsToken
,
EqualsEqualsToken
,
ExclamationEqualsToken
,
EqualsEqualsEqualsToken
,
ExclamationEqualsEqualsToken
,
EqualsGreaterThanToken
,
PlusToken
,
MinusToken
,
AsteriskToken
,
AsteriskAsteriskToken
,
SlashToken
,
PercentToken
,
PlusPlusToken
,
MinusMinusToken
,
LessThanLessThanToken
,
GreaterThanGreaterThanToken
,
GreaterThanGreaterThanGreaterThanToken
,
AmpersandToken
,
BarToken
,
CaretToken
,
ExclamationToken
,
TildeToken
,
AmpersandAmpersandToken
,
BarBarToken
,
QuestionToken
,
ColonToken
,
AtToken
,
// Assignments
EqualsToken
,
PlusEqualsToken
,
MinusEqualsToken
,
AsteriskEqualsToken
,
AsteriskAsteriskEqualsToken
,
SlashEqualsToken
,
PercentEqualsToken
,
LessThanLessThanEqualsToken
,
GreaterThanGreaterThanEqualsToken
,
GreaterThanGreaterThanGreaterThanEqualsToken
,
AmpersandEqualsToken
,
BarEqualsToken
,
CaretEqualsToken
,
// Identifiers
Identifier
,
// Reserved words
BreakKeyword
,
CaseKeyword
,
CatchKeyword
,
ClassKeyword
,
ConstKeyword
,
ContinueKeyword
,
DebuggerKeyword
,
DefaultKeyword
,
DeleteKeyword
,
DoKeyword
,
ElseKeyword
,
EnumKeyword
,
ExportKeyword
,
ExtendsKeyword
,
FalseKeyword
,
FinallyKeyword
,
ForKeyword
,
FunctionKeyword
,
IfKeyword
,
ImportKeyword
,
InKeyword
,
InstanceOfKeyword
,
NewKeyword
,
NullKeyword
,
ReturnKeyword
,
SuperKeyword
,
SwitchKeyword
,
ThisKeyword
,
ThrowKeyword
,
TrueKeyword
,
TryKeyword
,
TypeOfKeyword
,
VarKeyword
,
VoidKeyword
,
WhileKeyword
,
WithKeyword
,
// Strict mode reserved words
ImplementsKeyword
,
InterfaceKeyword
,
LetKeyword
,
PackageKeyword
,
PrivateKeyword
,
ProtectedKeyword
,
PublicKeyword
,
StaticKeyword
,
YieldKeyword
,
// Contextual keywords
AbstractKeyword
,
AsKeyword
,
AnyKeyword
,
AsyncKeyword
,
AwaitKeyword
,
BooleanKeyword
,
ConstructorKeyword
,
DeclareKeyword
,
GetKeyword
,
IsKeyword
,
KeyOfKeyword
,
ModuleKeyword
,
NamespaceKeyword
,
NeverKeyword
,
ReadonlyKeyword
,
RequireKeyword
,
NumberKeyword
,
SetKeyword
,
StringKeyword
,
SymbolKeyword
,
TypeKeyword
,
UndefinedKeyword
,
FromKeyword
,
GlobalKeyword
,
OfKeyword
,
// LastKeyword and LastToken
// Parse tree nodes
// Names
QualifiedName
,
ComputedPropertyName
,
// Signature elements
TypeParameter
,
Parameter
,
Decorator
,
// TypeMember
PropertySignature
,
PropertyDeclaration
,
MethodSignature
,
MethodDeclaration
,
Constructor
,
GetAccessor
,
SetAccessor
,
CallSignature
,
ConstructSignature
,
IndexSignature
,
// Type
TypePredicate
,
TypeReference
,
FunctionType
,
ConstructorType
,
TypeQuery
,
TypeLiteral
,
ArrayType
,
TupleType
,
UnionType
,
IntersectionType
,
ParenthesizedType
,
ThisType
,
TypeOperator
,
IndexedAccessType
,
LiteralType
,
// Binding patterns
ObjectBindingPattern
,
ArrayBindingPattern
,
BindingElement
,
// Expression
ArrayLiteralExpression
,
ObjectLiteralExpression
,
PropertyAccessExpression
,
ElementAccessExpression
,
CallExpression
,
NewExpression
,
TaggedTemplateExpression
,
TypeAssertionExpression
,
ParenthesizedExpression
,
FunctionExpression
,
ArrowFunction
,
DeleteExpression
,
TypeOfExpression
,
VoidExpression
,
AwaitExpression
,
PrefixUnaryExpression
,
PostfixUnaryExpression
,
BinaryExpression
,
ConditionalExpression
,
TemplateExpression
,
YieldExpression
,
SpreadElementExpression
,
ClassExpression
,
OmittedExpression
,
ExpressionWithTypeArguments
,
AsExpression
,
NonNullExpression
,
// Misc
TemplateSpan
,
SemicolonClassElement
,
// Element
Block
,
VariableStatement
,
EmptyStatement
,
ExpressionStatement
,
IfStatement
,
DoStatement
,
WhileStatement
,
ForStatement
,
ForInStatement
,
ForOfStatement
,
ContinueStatement
,
BreakStatement
,
ReturnStatement
,
WithStatement
,
SwitchStatement
,
LabeledStatement
,
ThrowStatement
,
TryStatement
,
DebuggerStatement
,
VariableDeclaration
,
VariableDeclarationList
,
FunctionDeclaration
,
ClassDeclaration
,
InterfaceDeclaration
,
TypeAliasDeclaration
,
EnumDeclaration
,
ModuleDeclaration
,
ModuleBlock
,
CaseBlock
,
NamespaceExportDeclaration
,
ImportEqualsDeclaration
,
ImportDeclaration
,
ImportClause
,
NamespaceImport
,
NamedImports
,
ImportSpecifier
,
ExportAssignment
,
ExportDeclaration
,
NamedExports
,
ExportSpecifier
,
MissingDeclaration
,
// Module references
ExternalModuleReference
,
// JSX
JsxElement
,
JsxSelfClosingElement
,
JsxOpeningElement
,
JsxClosingElement
,
JsxAttribute
,
JsxSpreadAttribute
,
JsxExpression
,
// Clauses
CaseClause
,
DefaultClause
,
HeritageClause
,
CatchClause
,
// Property assignments
PropertyAssignment
,
ShorthandPropertyAssignment
,
// Enum
EnumMember
,
// Top-level nodes
SourceFile
,
// JSDoc nodes
JSDocTypeExpression
,
// The * type
JSDocAllType
,
// The ? type
JSDocUnknownType
,
JSDocArrayType
,
JSDocUnionType
,
JSDocTupleType
,
JSDocNullableType
,
JSDocNonNullableType
,
JSDocRecordType
,
JSDocRecordMember
,
JSDocTypeReference
,
JSDocOptionalType
,
JSDocFunctionType
,
JSDocVariadicType
,
JSDocConstructorType
,
JSDocThisType
,
JSDocComment
,
JSDocTag
,
JSDocParameterTag
,
JSDocReturnTag
,
JSDocTypeTag
,
JSDocTemplateTag
,
JSDocTypedefTag
,
JSDocPropertyTag
,
JSDocTypeLiteral
,
JSDocLiteralType
,
JSDocNullKeyword
,
JSDocUndefinedKeyword
,
JSDocNeverKeyword
,
// Synthesized list
SyntaxList
,
// Transformation nodes
NotEmittedStatement
,
PartiallyEmittedExpression
,
MergeDeclarationMarker
,
EndOfDeclarationMarker
,
// Enum value count
Count
,
// Markers
FirstAssignment
=
EqualsToken
,
LastAssignment
=
CaretEqualsToken
,
FirstCompoundAssignment
=
PlusEqualsToken
,
LastCompoundAssignment
=
CaretEqualsToken
,
FirstReservedWord
=
BreakKeyword
,
LastReservedWord
=
WithKeyword
,
FirstKeyword
=
BreakKeyword
,
LastKeyword
=
OfKeyword
,
FirstFutureReservedWord
=
ImplementsKeyword
,
LastFutureReservedWord
=
YieldKeyword
,
FirstTypeNode
=
TypePredicate
,
LastTypeNode
=
LiteralType
,
FirstPunctuation
=
OpenBraceToken
,
LastPunctuation
=
CaretEqualsToken
,
FirstToken
=
Unknown
,
LastToken
=
LastKeyword
,
FirstTriviaToken
=
SingleLineCommentTrivia
,
LastTriviaToken
=
ConflictMarkerTrivia
,
FirstLiteralToken
=
NumericLiteral
,
LastLiteralToken
=
NoSubstitutionTemplateLiteral
,
FirstTemplateToken
=
NoSubstitutionTemplateLiteral
,
LastTemplateToken
=
TemplateTail
,
FirstBinaryOperator
=
LessThanToken
,
LastBinaryOperator
=
CaretEqualsToken
,
FirstNode
=
QualifiedName
,
FirstJSDocNode
=
JSDocTypeExpression
,
LastJSDocNode
=
JSDocLiteralType
,
FirstJSDocTagNode
=
JSDocComment
,
LastJSDocTagNode
=
JSDocNeverKeyword
}
export
const
enum
NodeFlags
{
None
=
0
,
Let
=
1
<<
0
,
// Variable declaration
Const
=
1
<<
1
,
// Variable declaration
NestedNamespace
=
1
<<
2
,
// Namespace declaration
Synthesized
=
1
<<
3
,
// Node was synthesized during transformation
Namespace
=
1
<<
4
,
// Namespace declaration
ExportContext
=
1
<<
5
,
// Export context (initialized by binding)
ContainsThis
=
1
<<
6
,
// Interface contains references to "this"
HasImplicitReturn
=
1
<<
7
,
// If function implicitly returns on one of codepaths (initialized by binding)
HasExplicitReturn
=
1
<<
8
,
// If function has explicit reachable return on one of codepaths (initialized by binding)
GlobalAugmentation
=
1
<<
9
,
// Set if module declaration is an augmentation for the global scope
HasClassExtends
=
1
<<
10
,
// If the file has a non-ambient class with an extends clause in ES5 or lower (initialized by binding)
HasDecorators
=
1
<<
11
,
// If the file has decorators (initialized by binding)
HasParamDecorators
=
1
<<
12
,
// If the file has parameter decorators (initialized by binding)
HasAsyncFunctions
=
1
<<
13
,
// If the file has async functions (initialized by binding)
HasJsxSpreadAttributes
=
1
<<
14
,
// If the file as JSX spread attributes (initialized by binding)
DisallowInContext
=
1
<<
15
,
// If node was parsed in a context where 'in-expressions' are not allowed
YieldContext
=
1
<<
16
,
// If node was parsed in the 'yield' context created when parsing a generator
DecoratorContext
=
1
<<
17
,
// If node was parsed as part of a decorator
AwaitContext
=
1
<<
18
,
// If node was parsed in the 'await' context created when parsing an async function
ThisNodeHasError
=
1
<<
19
,
// If the parser encountered an error when parsing the code that created this node
JavaScriptFile
=
1
<<
20
,
// If node was parsed in a JavaScript
ThisNodeOrAnySubNodesHasError
=
1
<<
21
,
// If this node or any of its children had an error
HasAggregatedChildData
=
1
<<
22
,
// If we've computed data from children and cached it in this node
BlockScoped
=
Let
|
Const
,
ReachabilityCheckFlags
=
HasImplicitReturn
|
HasExplicitReturn
,
EmitHelperFlags
=
HasClassExtends
|
HasDecorators
|
HasParamDecorators
|
HasAsyncFunctions
|
HasJsxSpreadAttributes
,
ReachabilityAndEmitFlags
=
ReachabilityCheckFlags
|
EmitHelperFlags
,
// Parsing context flags
ContextFlags
=
DisallowInContext
|
YieldContext
|
DecoratorContext
|
AwaitContext
|
JavaScriptFile
,
// Exclude these flags when parsing a Type
TypeExcludesFlags
=
YieldContext
|
AwaitContext
,
}
export
const
enum
ModifierFlags
{
None
=
0
,
Export
=
1
<<
0
,
// Declarations
Ambient
=
1
<<
1
,
// Declarations
Public
=
1
<<
2
,
// Property/Method
Private
=
1
<<
3
,
// Property/Method
Protected
=
1
<<
4
,
// Property/Method
Static
=
1
<<
5
,
// Property/Method
Readonly
=
1
<<
6
,
// Property/Method
Abstract
=
1
<<
7
,
// Class/Method/ConstructSignature
Async
=
1
<<
8
,
// Property/Method/Function
Default
=
1
<<
9
,
// Function/Class (export default declaration)
Const
=
1
<<
11
,
// Variable declaration
HasComputedFlags
=
1
<<
29
,
// Modifier flags have been computed
AccessibilityModifier
=
Public
|
Private
|
Protected
,
// Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property.
ParameterPropertyModifier
=
AccessibilityModifier
|
Readonly
,
NonPublicAccessibilityModifier
=
Private
|
Protected
,
TypeScriptModifier
=
Ambient
|
Public
|
Private
|
Protected
|
Readonly
|
Abstract
|
Const
,
ExportDefault
=
Export
|
Default
,
}
export
const
enum
JsxFlags
{
None
=
0
,
/** An element from a named property of the JSX.IntrinsicElements interface */
IntrinsicNamedElement
=
1
<<
0
,
/** An element inferred from the string index signature of the JSX.IntrinsicElements interface */
IntrinsicIndexedElement
=
1
<<
1
,
IntrinsicElement
=
IntrinsicNamedElement
|
IntrinsicIndexedElement
,
}
/*
@internal
*/
export
const
enum
RelationComparisonResult
{
Succeeded
=
1
,
// Should be truthy
Failed
=
2
,
FailedAndReported
=
3
}
export
interface
Node
extends
TextRange
{
kind
:
SyntaxKind
;
flags
:
NodeFlags
;
/*
@internal
*/
modifierFlagsCache
?:
ModifierFlags
;
/*
@internal
*/
transformFlags
?:
TransformFlags
;
decorators
?:
NodeArray
<
Decorator
>
;
// Array of decorators (in document order)
modifiers
?:
ModifiersArray
;
// Array of modifiers
/*
@internal
*/
id
?:
number
;
// Unique id (used to look up NodeLinks)
parent
?:
Node
;
// Parent node (initialized by binding)
/*
@internal
*/
original
?:
Node
;
// The original node if this is an updated node.
/*
@internal
*/
startsOnNewLine
?:
boolean
;
// Whether a synthesized node should start on a new line (used by transforms).
/*
@internal
*/
jsDocComments
?:
JSDoc
[
]
;
// JSDoc for the node, if it has any.
/*
@internal
*/
symbol
?:
Symbol
;
// Symbol declared by node (initialized by binding)
/*
@internal
*/
locals
?:
SymbolTable
;
// Locals associated with node (initialized by binding)
/*
@internal
*/
nextContainer
?:
Node
;
// Next container in declaration order (initialized by binding)
/*
@internal
*/
localSymbol
?:
Symbol
;
// Local symbol declared by node (initialized by binding only for exported nodes)
/*
@internal
*/
flowNode
?:
FlowNode
;
// Associated FlowNode (initialized by binding)
/*
@internal
*/
emitNode
?:
EmitNode
;
// Associated EmitNode (initialized by transforms)
}
export
interface
NodeArray
<
T
extends
Node
>
extends
Array
<
T
>
,
TextRange
{
hasTrailingComma
?:
boolean
;
}
export
interface
Token
<
TKind
extends
SyntaxKind
>
extends
Node
{
kind
:
TKind
;
}
export
type
DotDotDotToken
=
Token
<
SyntaxKind
.
DotDotDotToken
>
;
export
type
QuestionToken
=
Token
<
SyntaxKind
.
QuestionToken
>
;
export
type
ColonToken
=
Token
<
SyntaxKind
.
ColonToken
>
;
export
type
EqualsToken
=
Token
<
SyntaxKind
.
EqualsToken
>
;
export
type
AsteriskToken
=
Token
<
SyntaxKind
.
AsteriskToken
>
;
export
type
EqualsGreaterThanToken
=
Token
<
SyntaxKind
.
EqualsGreaterThanToken
>
;
export
type
EndOfFileToken
=
Token
<
SyntaxKind
.
EndOfFileToken
>
;
export
type
AtToken
=
Token
<
SyntaxKind
.
AtToken
>
;
export
type
Modifier
=
Token
<
SyntaxKind
.
AbstractKeyword
>
|
Token
<
SyntaxKind
.
AsyncKeyword
>
|
Token
<
SyntaxKind
.
ConstKeyword
>
|
Token
<
SyntaxKind
.
DeclareKeyword
>
|
Token
<
SyntaxKind
.
DefaultKeyword
>
|
Token
<
SyntaxKind
.
ExportKeyword
>
|
Token
<
SyntaxKind
.
PublicKeyword
>
|
Token
<
SyntaxKind
.
PrivateKeyword
>
|
Token
<
SyntaxKind
.
ProtectedKeyword
>
|
Token
<
SyntaxKind
.
ReadonlyKeyword
>
|
Token
<
SyntaxKind
.
StaticKeyword
>
;
export
type
ModifiersArray
=
NodeArray
<
Modifier
>
;
/*
@internal
*/
export
const
enum
GeneratedIdentifierKind
{
None
,
// Not automatically generated.
Auto
,
// Automatically generated identifier.
Loop
,
// Automatically generated identifier with a preference for '_i'.
Unique
,
// Unique name based on the 'text' property.
Node
,
// Unique name based on the node in the 'original' property.
}
export
interface
Identifier
extends
PrimaryExpression
{
kind
:
SyntaxKind
.
Identifier
;
text
:
string
;
// Text of identifier (with escapes converted to characters)
originalKeywordKind
?:
SyntaxKind
;
// Original syntaxKind which get set so that we can report an error later
/*
@internal
*/
autoGenerateKind
?:
GeneratedIdentifierKind
;
// Specifies whether to auto-generate the text for an identifier.
/*
@internal
*/
autoGenerateId
?:
number
;
// Ensures unique generated identifiers get unique names, but clones get the same name.
isInJSDocNamespace
?:
boolean
;
// if the node is a member in a JSDoc namespace
}
// Transient identifier node (marked by id === -1)
export
interface
TransientIdentifier
extends
Identifier
{
resolvedSymbol
:
Symbol
;
}
/*
@internal
*/
export
interface
GeneratedIdentifier
extends
Identifier
{
autoGenerateKind
:
GeneratedIdentifierKind
.
Auto
|
GeneratedIdentifierKind
.
Loop
|
GeneratedIdentifierKind
.
Unique
|
GeneratedIdentifierKind
.
Node
;
}
export
interface
QualifiedName
extends
Node
{
kind
:
SyntaxKind
.
QualifiedName
;
left
:
EntityName
;
right
:
Identifier
;
}
export
type
EntityName
=
Identifier
|
QualifiedName
;
export
type
PropertyName
=
Identifier
|
LiteralExpression
|
ComputedPropertyName
;
export
type
DeclarationName
=
Identifier
|
LiteralExpression
|
ComputedPropertyName
|
BindingPattern
;
export
interface
Declaration
extends
Node
{
_declarationBrand
:
any
;
name
?:
DeclarationName
;
}
export
interface
DeclarationStatement
extends
Declaration
,
Statement
{
name
?:
Identifier
|
LiteralExpression
;
}
export
interface
ComputedPropertyName
extends
Node
{
kind
:
SyntaxKind
.
ComputedPropertyName
;
expression
:
Expression
;
}
export
interface
Decorator
extends
Node
{
kind
:
SyntaxKind
.
Decorator
;
expression
:
LeftHandSideExpression
;
}
export
interface
TypeParameterDeclaration
extends
Declaration
{
kind
:
SyntaxKind
.
TypeParameter
;
name
:
Identifier
;
constraint
?:
TypeNode
;
// For error recovery purposes.
expression
?:
Expression
;
}
export
interface
SignatureDeclaration
extends
Declaration
{
name
?:
PropertyName
;
typeParameters
?:
NodeArray
<
TypeParameterDeclaration
>
;
parameters
:
NodeArray
<
ParameterDeclaration
>
;
type
?:
TypeNode
;
}
export
interface
CallSignatureDeclaration
extends
SignatureDeclaration
,
TypeElement
{
kind
:
SyntaxKind
.
CallSignature
;
}
export
interface
ConstructSignatureDeclaration
extends
SignatureDeclaration
,
TypeElement
{
kind
:
SyntaxKind
.
ConstructSignature
;
}
export
type
BindingName
=
Identifier
|
BindingPattern
;
export
interface
VariableDeclaration
extends
Declaration
{
kind
:
SyntaxKind
.
VariableDeclaration
;
parent
?:
VariableDeclarationList
;
name
:
BindingName
;
// Declared variable name
type
?:
TypeNode
;
// Optional type annotation
initializer
?:
Expression
;
// Optional initializer
}
export
interface
VariableDeclarationList
extends
Node
{
kind
:
SyntaxKind
.
VariableDeclarationList
;
declarations
:
NodeArray
<
VariableDeclaration
>
;
}
export
interface
ParameterDeclaration
extends
Declaration
{
kind
:
SyntaxKind
.
Parameter
;
dotDotDotToken
?:
DotDotDotToken
;
// Present on rest parameter
name
:
BindingName
;
// Declared parameter name
questionToken
?:
QuestionToken
;
// Present on optional parameter
type
?:
TypeNode
;
// Optional type annotation
initializer
?:
Expression
;
// Optional initializer
}
export
interface
BindingElement
extends
Declaration
{
kind
:
SyntaxKind
.
BindingElement
;
propertyName
?:
PropertyName
;
// Binding property name (in object binding pattern)
dotDotDotToken
?:
DotDotDotToken
;
// Present on rest binding element
name
:
BindingName
;
// Declared binding element name
initializer
?:
Expression
;
// Optional initializer
}
export
interface
PropertySignature
extends
TypeElement
{
kind
:
SyntaxKind
.
PropertySignature
|
SyntaxKind
.
JSDocRecordMember
;
name
:
PropertyName
;
// Declared property name
questionToken
?:
QuestionToken
;
// Present on optional property
type
?:
TypeNode
;
// Optional type annotation
initializer
?:
Expression
;
// Optional initializer
}
export
interface
PropertyDeclaration
extends
ClassElement
{
kind
:
SyntaxKind
.
PropertyDeclaration
;
questionToken
?:
QuestionToken
;
// Present for use with reporting a grammar error
name
:
PropertyName
;
type
?:
TypeNode
;
initializer
?:
Expression
;
// Optional initializer
}
export
interface
ObjectLiteralElement
extends
Declaration
{
_objectLiteralBrandBrand
:
any
;
name
?:
PropertyName
;
}
export
type
ObjectLiteralElementLike
=
PropertyAssignment
|
ShorthandPropertyAssignment
|
MethodDeclaration
|
AccessorDeclaration
;
export
interface
PropertyAssignment
extends
ObjectLiteralElement
{
kind
:
SyntaxKind
.
PropertyAssignment
;
name
:
PropertyName
;
questionToken
?:
QuestionToken
;
initializer
:
Expression
;
}
export
interface
ShorthandPropertyAssignment
extends
ObjectLiteralElement
{
kind
:
SyntaxKind
.
ShorthandPropertyAssignment
;
name
:
Identifier
;
questionToken
?:
QuestionToken
;
// used when ObjectLiteralExpression is used in ObjectAssignmentPattern
// it is grammar error to appear in actual object initializer
equalsToken
?:
Token
<
SyntaxKind
.
EqualsToken
>
;
objectAssignmentInitializer
?:
Expression
;
}
// SyntaxKind.VariableDeclaration
// SyntaxKind.Parameter
// SyntaxKind.BindingElement
// SyntaxKind.Property
// SyntaxKind.PropertyAssignment
// SyntaxKind.ShorthandPropertyAssignment
// SyntaxKind.EnumMember
// SyntaxKind.JSDocPropertyTag
export
interface
VariableLikeDeclaration
extends
Declaration
{
propertyName
?:
PropertyName
;
dotDotDotToken
?:
DotDotDotToken
;
name
:
DeclarationName
;
questionToken
?:
QuestionToken
;
type
?:
TypeNode
;
initializer
?:
Expression
;
}
export
interface
PropertyLikeDeclaration
extends
Declaration
{
name
:
PropertyName
;
}
export
interface
BindingPattern
extends
Node
{
elements
:
NodeArray
<
BindingElement
|
ArrayBindingElement
>
;
}
export
interface
ObjectBindingPattern
extends
BindingPattern
{
kind
:
SyntaxKind
.
ObjectBindingPattern
;
elements
:
NodeArray
<
BindingElement
>
;
}
export
type
ArrayBindingElement
=
BindingElement
|
OmittedExpression
;
export
interface
ArrayBindingPattern
extends
BindingPattern
{
kind
:
SyntaxKind
.
ArrayBindingPattern
;
elements
:
NodeArray
<
ArrayBindingElement
>
;
}
/**
* Several node kinds share function-like features such as a signature,
* a name, and a body. These nodes should extend FunctionLikeDeclaration.
* Examples:
* - FunctionDeclaration
* - MethodDeclaration
* - AccessorDeclaration
*/
export
interface
FunctionLikeDeclaration
extends
SignatureDeclaration
{
_functionLikeDeclarationBrand
:
any
;
asteriskToken
?:
AsteriskToken
;
questionToken
?:
QuestionToken
;
body
?:
Block
|
Expression
;
}
export
interface
FunctionDeclaration
extends
FunctionLikeDeclaration
,
DeclarationStatement
{
kind
:
SyntaxKind
.
FunctionDeclaration
;
name
?:
Identifier
;
body
?:
FunctionBody
;
}
export
interface
MethodSignature
extends
SignatureDeclaration
,
TypeElement
{
kind
:
SyntaxKind
.
MethodSignature
;
name
:
PropertyName
;
}
// Note that a MethodDeclaration is considered both a ClassElement and an ObjectLiteralElement.
// Both the grammars for ClassDeclaration and ObjectLiteralExpression allow for MethodDeclarations
// as child elements, and so a MethodDeclaration satisfies both interfaces. This avoids the
// alternative where we would need separate kinds/types for ClassMethodDeclaration and
// ObjectLiteralMethodDeclaration, which would look identical.
//
// Because of this, it may be necessary to determine what sort of MethodDeclaration you have
// at later stages of the compiler pipeline. In that case, you can either check the parent kind
// of the method, or use helpers like isObjectLiteralMethodDeclaration
export
interface
MethodDeclaration
extends
FunctionLikeDeclaration
,
ClassElement
,
ObjectLiteralElement
{
kind
:
SyntaxKind
.
MethodDeclaration
;
name
:
PropertyName
;
body
?:
FunctionBody
;
}
export
interface
ConstructorDeclaration
extends
FunctionLikeDeclaration
,
ClassElement
{
kind
:
SyntaxKind
.
Constructor
;
body
?:
FunctionBody
;
}
// For when we encounter a semicolon in a class declaration. ES6 allows these as class elements.
export
interface
SemicolonClassElement
extends
ClassElement
{
kind
:
SyntaxKind
.
SemicolonClassElement
;
}
// See the comment on MethodDeclaration for the intuition behind GetAccessorDeclaration being a
// ClassElement and an ObjectLiteralElement.
export
interface
GetAccessorDeclaration
extends
FunctionLikeDeclaration
,
ClassElement
,
ObjectLiteralElement
{
kind
:
SyntaxKind
.
GetAccessor
;
name
:
PropertyName
;
body
:
FunctionBody
;
}
// See the comment on MethodDeclaration for the intuition behind SetAccessorDeclaration being a
// ClassElement and an ObjectLiteralElement.
export
interface
SetAccessorDeclaration
extends
FunctionLikeDeclaration
,
ClassElement
,
ObjectLiteralElement
{
kind
:
SyntaxKind
.
SetAccessor
;
name
:
PropertyName
;
body
:
FunctionBody
;
}
export
type
AccessorDeclaration
=
GetAccessorDeclaration
|
SetAccessorDeclaration
;
export
interface
IndexSignatureDeclaration
extends
SignatureDeclaration
,
ClassElement
,
TypeElement
{
kind
:
SyntaxKind
.
IndexSignature
;
}
export
interface
TypeNode
extends
Node
{
_typeNodeBrand
:
any
;
}
export
interface
KeywordTypeNode
extends
TypeNode
{
kind
:
SyntaxKind
.
AnyKeyword
|
SyntaxKind
.
NumberKeyword
|
SyntaxKind
.
BooleanKeyword
|
SyntaxKind
.
StringKeyword
|
SyntaxKind
.
SymbolKeyword
|
SyntaxKind
.
VoidKeyword
;
}
export
interface
ThisTypeNode
extends
TypeNode
{
kind
:
SyntaxKind
.
ThisType
;
}
export
interface
FunctionOrConstructorTypeNode
extends
TypeNode
,
SignatureDeclaration
{
kind
:
SyntaxKind
.
FunctionType
|
SyntaxKind
.
ConstructorType
;
}
export
interface
FunctionTypeNode
extends
FunctionOrConstructorTypeNode
{
kind
:
SyntaxKind
.
FunctionType
;
}
export
interface
ConstructorTypeNode
extends
FunctionOrConstructorTypeNode
{
kind
:
SyntaxKind
.
ConstructorType
;
}
export
interface
TypeReferenceNode
extends
TypeNode
{
kind
:
SyntaxKind
.
TypeReference
;
typeName
:
EntityName
;
typeArguments
?:
NodeArray
<
TypeNode
>
;
}
export
interface
TypePredicateNode
extends
TypeNode
{
kind
:
SyntaxKind
.
TypePredicate
;
parameterName
:
Identifier
|
ThisTypeNode
;
type
:
TypeNode
;
}
export
interface
TypeQueryNode
extends
TypeNode
{
kind
:
SyntaxKind
.
TypeQuery
;
exprName
:
EntityName
;
}
// A TypeLiteral is the declaration node for an anonymous symbol.
export
interface
TypeLiteralNode
extends
TypeNode
,
Declaration
{
kind
:
SyntaxKind
.
TypeLiteral
;
members
:
NodeArray
<
TypeElement
>
;
}
export
interface
ArrayTypeNode
extends
TypeNode
{
kind
:
SyntaxKind
.
ArrayType
;
elementType
:
TypeNode
;
}
export
interface
TupleTypeNode
extends
TypeNode
{
kind
:
SyntaxKind
.
TupleType
;
elementTypes
:
NodeArray
<
TypeNode
>
;
}
export
interface
UnionOrIntersectionTypeNode
extends
TypeNode
{
kind
:
SyntaxKind
.
UnionType
|
SyntaxKind
.
IntersectionType
;
types
:
NodeArray
<
TypeNode
>
;
}
export
interface
UnionTypeNode
extends
UnionOrIntersectionTypeNode
{
kind
:
SyntaxKind
.
UnionType
;
}
export
interface
IntersectionTypeNode
extends
UnionOrIntersectionTypeNode
{
kind
:
SyntaxKind
.
IntersectionType
;
}
export
interface
ParenthesizedTypeNode
extends
TypeNode
{
kind
:
SyntaxKind
.
ParenthesizedType
;
type
:
TypeNode
;
}
export
interface
TypeOperatorNode
extends
TypeNode
{
kind
:
SyntaxKind
.
TypeOperator
;
operator
:
SyntaxKind
.
KeyOfKeyword
;
type
:
TypeNode
;
}
export
interface
IndexedAccessTypeNode
extends
TypeNode
{
kind
:
SyntaxKind
.
IndexedAccessType
;
objectType
:
TypeNode
;
indexType
:
TypeNode
;
}
export
interface
LiteralTypeNode
extends
TypeNode
{
kind
:
SyntaxKind
.
LiteralType
;
literal
:
Expression
;
}
export
interface
StringLiteral
extends
LiteralExpression
{
kind
:
SyntaxKind
.
StringLiteral
;
/*
@internal
*/
textSourceNode
?:
Identifier
|
StringLiteral
;
// Allows a StringLiteral to get its text from another node (used by transforms).
}
// Note: 'brands' in our syntax nodes serve to give us a small amount of nominal typing.
// Consider 'Expression'. Without the brand, 'Expression' is actually no different
// (structurally) than 'Node'. Because of this you can pass any Node to a function that
// takes an Expression without any error. By using the 'brands' we ensure that the type
// checker actually thinks you have something of the right type. Note: the brands are
// never actually given values. At runtime they have zero cost.
export
interface
Expression
extends
Node
{
_expressionBrand
:
any
;
contextualType
?:
Type
;
// Used to temporarily assign a contextual type during overload resolution
}
export
interface
OmittedExpression
extends
Expression
{
kind
:
SyntaxKind
.
OmittedExpression
;
}
// Represents an expression that is elided as part of a transformation to emit comments on a
// not-emitted node. The 'expression' property of a NotEmittedExpression should be emitted.
//
@internal
export
interface
PartiallyEmittedExpression
extends
LeftHandSideExpression
{
kind
:
SyntaxKind
.
PartiallyEmittedExpression
;
expression
:
Expression
;
}
export
interface
UnaryExpression
extends
Expression
{
_unaryExpressionBrand
:
any
;
}
export
interface
IncrementExpression
extends
UnaryExpression
{
_incrementExpressionBrand
:
any
;
}
// see: https://tc39.github.io/ecma262/#prod-UpdateExpression
// see: https://tc39.github.io/ecma262/#prod-UnaryExpression
export
type
PrefixUnaryOperator
=
SyntaxKind
.
PlusPlusToken
|
SyntaxKind
.
MinusMinusToken
|
SyntaxKind
.
PlusToken
|
SyntaxKind
.
MinusToken
|
SyntaxKind
.
TildeToken
|
SyntaxKind
.
ExclamationToken
;
export
interface
PrefixUnaryExpression
extends
IncrementExpression
{
kind
:
SyntaxKind
.
PrefixUnaryExpression
;
operator
:
PrefixUnaryOperator
;
operand
:
UnaryExpression
;
}
// see: https://tc39.github.io/ecma262/#prod-UpdateExpression
export
type
PostfixUnaryOperator
=
SyntaxKind
.
PlusPlusToken
|
SyntaxKind
.
MinusMinusToken
;
export
interface
PostfixUnaryExpression
extends
IncrementExpression
{
kind
:
SyntaxKind
.
PostfixUnaryExpression
;
operand
:
LeftHandSideExpression
;
operator
:
PostfixUnaryOperator
;
}
export
interface
LeftHandSideExpression
extends
IncrementExpression
{
_leftHandSideExpressionBrand
:
any
;
}
export
interface
MemberExpression
extends
LeftHandSideExpression
{
_memberExpressionBrand
:
any
;
}
export
interface
PrimaryExpression
extends
MemberExpression
{
_primaryExpressionBrand
:
any
;
}
export
interface
NullLiteral
extends
PrimaryExpression
{
kind
:
SyntaxKind
.
NullKeyword
;
}
export
interface
BooleanLiteral
extends
PrimaryExpression
{
kind
:
SyntaxKind
.
TrueKeyword
|
SyntaxKind
.
FalseKeyword
;
}
export
interface
ThisExpression
extends
PrimaryExpression
{
kind
:
SyntaxKind
.
ThisKeyword
;
}
export
interface
SuperExpression
extends
PrimaryExpression
{
kind
:
SyntaxKind
.
SuperKeyword
;
}
export
interface
DeleteExpression
extends
UnaryExpression
{
kind
:
SyntaxKind
.
DeleteExpression
;
View remainder of file in raw view
Footer
© 2026 GitHub, Inc.
Footer navigation
Terms
Privacy
Security
Status
Community
Docs
Contact
You can’t perform that action at this time.
Back
|
FazBrowse Home
|
New Git URL