/
nodeTests.ts
1201 lines (952 loc) · 35.9 KB
/
nodeTests.ts
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
import {
AbstractKeyword,
AccessorKeyword,
ArrayBindingPattern,
ArrayLiteralExpression,
ArrayTypeNode,
ArrowFunction,
AsExpression,
AssertClause,
AssertEntry,
AssertsKeyword,
AsteriskToken,
AsyncKeyword,
AwaitExpression,
AwaitKeyword,
BigIntLiteral,
BinaryExpression,
BindingElement,
Block,
BreakStatement,
Bundle,
CallExpression,
CallSignatureDeclaration,
CaseBlock,
CaseClause,
CaseKeyword,
CatchClause,
ClassDeclaration,
ClassExpression,
ClassStaticBlockDeclaration,
ColonToken,
CommaListExpression,
ComputedPropertyName,
ConditionalExpression,
ConditionalTypeNode,
ConstructorDeclaration,
ConstructorTypeNode,
ConstructSignatureDeclaration,
ContinueStatement,
DebuggerStatement,
Decorator,
DefaultClause,
DefaultKeyword,
DeleteExpression,
DoStatement,
DotDotDotToken,
ElementAccessExpression,
EmptyStatement,
EnumDeclaration,
EnumMember,
EqualsGreaterThanToken,
ExclamationToken,
ExportAssignment,
ExportDeclaration,
ExportKeyword,
ExportSpecifier,
ExpressionStatement,
ExpressionWithTypeArguments,
ExternalModuleReference,
ForInStatement,
ForOfStatement,
ForStatement,
FunctionDeclaration,
FunctionExpression,
FunctionTypeNode,
GetAccessorDeclaration,
HeritageClause,
Identifier,
IfStatement,
ImportAttribute,
ImportAttributes,
ImportClause,
ImportDeclaration,
ImportEqualsDeclaration,
ImportExpression,
ImportSpecifier,
ImportTypeAssertionContainer,
ImportTypeNode,
IndexedAccessTypeNode,
IndexSignatureDeclaration,
InferTypeNode,
InterfaceDeclaration,
IntersectionTypeNode,
JSDoc,
JSDocAllType,
JSDocAugmentsTag,
JSDocAuthorTag,
JSDocCallbackTag,
JSDocClassTag,
JSDocDeprecatedTag,
JSDocEnumTag,
JSDocFunctionType,
JSDocImplementsTag,
JSDocImportTag,
JSDocInternalTag,
JSDocLink,
JSDocLinkCode,
JSDocLinkPlain,
JSDocMemberName,
JSDocNamepathType,
JSDocNameReference,
JSDocNonNullableType,
JSDocNullableType,
JSDocOptionalType,
JSDocOverloadTag,
JSDocOverrideTag,
JSDocParameterTag,
JSDocPrivateTag,
JSDocPropertyTag,
JSDocProtectedTag,
JSDocPublicTag,
JSDocReadonlyTag,
JSDocReturnTag,
JSDocSatisfiesTag,
JSDocSeeTag,
JSDocSignature,
JSDocTemplateTag,
JSDocThisTag,
JSDocThrowsTag,
JSDocTypedefTag,
JSDocTypeExpression,
JSDocTypeLiteral,
JSDocTypeTag,
JSDocUnknownTag,
JSDocUnknownType,
JSDocVariadicType,
JsxAttribute,
JsxAttributes,
JsxClosingElement,
JsxClosingFragment,
JsxElement,
JsxExpression,
JsxFragment,
JsxNamespacedName,
JsxOpeningElement,
JsxOpeningFragment,
JsxSelfClosingElement,
JsxSpreadAttribute,
JsxText,
LabeledStatement,
LiteralTypeNode,
MappedTypeNode,
MetaProperty,
MethodDeclaration,
MethodSignature,
MinusToken,
MissingDeclaration,
ModuleBlock,
ModuleDeclaration,
NamedExports,
NamedImports,
NamedTupleMember,
NamespaceExport,
NamespaceExportDeclaration,
NamespaceImport,
NewExpression,
Node,
NonNullExpression,
NoSubstitutionTemplateLiteral,
NotEmittedStatement,
NumericLiteral,
ObjectBindingPattern,
ObjectLiteralExpression,
OmittedExpression,
OptionalTypeNode,
OverrideKeyword,
ParameterDeclaration,
ParenthesizedExpression,
ParenthesizedTypeNode,
PartiallyEmittedExpression,
PlusToken,
PostfixUnaryExpression,
PrefixUnaryExpression,
PrivateIdentifier,
PropertyAccessExpression,
PropertyAssignment,
PropertyDeclaration,
PropertySignature,
QualifiedName,
QuestionDotToken,
QuestionToken,
ReadonlyKeyword,
RegularExpressionLiteral,
RestTypeNode,
ReturnStatement,
SatisfiesExpression,
SemicolonClassElement,
SetAccessorDeclaration,
ShorthandPropertyAssignment,
SourceFile,
SpreadAssignment,
SpreadElement,
StaticKeyword,
StringLiteral,
SuperExpression,
SwitchStatement,
SyntaxKind,
SyntaxList,
SyntheticExpression,
SyntheticReferenceExpression,
TaggedTemplateExpression,
TemplateExpression,
TemplateHead,
TemplateLiteralTypeNode,
TemplateLiteralTypeSpan,
TemplateMiddle,
TemplateSpan,
TemplateTail,
ThisTypeNode,
ThrowStatement,
Token,
TryStatement,
TupleTypeNode,
TypeAliasDeclaration,
TypeAssertion,
TypeLiteralNode,
TypeOfExpression,
TypeOperatorNode,
TypeParameterDeclaration,
TypePredicateNode,
TypeQueryNode,
TypeReferenceNode,
UnionTypeNode,
VariableDeclaration,
VariableDeclarationList,
VariableStatement,
VoidExpression,
WhileStatement,
WithStatement,
YieldExpression,
} from "../_namespaces/ts";
// Literals
export function isNumericLiteral(node: Node): node is NumericLiteral {
return node.kind === SyntaxKind.NumericLiteral;
}
export function isBigIntLiteral(node: Node): node is BigIntLiteral {
return node.kind === SyntaxKind.BigIntLiteral;
}
export function isStringLiteral(node: Node): node is StringLiteral {
return node.kind === SyntaxKind.StringLiteral;
}
export function isJsxText(node: Node): node is JsxText {
return node.kind === SyntaxKind.JsxText;
}
export function isRegularExpressionLiteral(node: Node): node is RegularExpressionLiteral {
return node.kind === SyntaxKind.RegularExpressionLiteral;
}
export function isNoSubstitutionTemplateLiteral(node: Node): node is NoSubstitutionTemplateLiteral {
return node.kind === SyntaxKind.NoSubstitutionTemplateLiteral;
}
// Pseudo-literals
export function isTemplateHead(node: Node): node is TemplateHead {
return node.kind === SyntaxKind.TemplateHead;
}
export function isTemplateMiddle(node: Node): node is TemplateMiddle {
return node.kind === SyntaxKind.TemplateMiddle;
}
export function isTemplateTail(node: Node): node is TemplateTail {
return node.kind === SyntaxKind.TemplateTail;
}
// Punctuation
export function isDotDotDotToken(node: Node): node is DotDotDotToken {
return node.kind === SyntaxKind.DotDotDotToken;
}
/** @internal */
export function isCommaToken(node: Node): node is Token<SyntaxKind.CommaToken> {
return node.kind === SyntaxKind.CommaToken;
}
export function isPlusToken(node: Node): node is PlusToken {
return node.kind === SyntaxKind.PlusToken;
}
export function isMinusToken(node: Node): node is MinusToken {
return node.kind === SyntaxKind.MinusToken;
}
export function isAsteriskToken(node: Node): node is AsteriskToken {
return node.kind === SyntaxKind.AsteriskToken;
}
export function isExclamationToken(node: Node): node is ExclamationToken {
return node.kind === SyntaxKind.ExclamationToken;
}
export function isQuestionToken(node: Node): node is QuestionToken {
return node.kind === SyntaxKind.QuestionToken;
}
export function isColonToken(node: Node): node is ColonToken {
return node.kind === SyntaxKind.ColonToken;
}
export function isQuestionDotToken(node: Node): node is QuestionDotToken {
return node.kind === SyntaxKind.QuestionDotToken;
}
export function isEqualsGreaterThanToken(node: Node): node is EqualsGreaterThanToken {
return node.kind === SyntaxKind.EqualsGreaterThanToken;
}
// Identifiers
export function isIdentifier(node: Node): node is Identifier {
return node.kind === SyntaxKind.Identifier;
}
export function isPrivateIdentifier(node: Node): node is PrivateIdentifier {
return node.kind === SyntaxKind.PrivateIdentifier;
}
// Reserved Words
/** @internal */
export function isExportModifier(node: Node): node is ExportKeyword {
return node.kind === SyntaxKind.ExportKeyword;
}
/** @internal */
export function isDefaultModifier(node: Node): node is DefaultKeyword {
return node.kind === SyntaxKind.DefaultKeyword;
}
/** @internal */
export function isAsyncModifier(node: Node): node is AsyncKeyword {
return node.kind === SyntaxKind.AsyncKeyword;
}
export function isAssertsKeyword(node: Node): node is AssertsKeyword {
return node.kind === SyntaxKind.AssertsKeyword;
}
export function isAwaitKeyword(node: Node): node is AwaitKeyword {
return node.kind === SyntaxKind.AwaitKeyword;
}
/** @internal */
export function isReadonlyKeyword(node: Node): node is ReadonlyKeyword {
return node.kind === SyntaxKind.ReadonlyKeyword;
}
/** @internal */
export function isStaticModifier(node: Node): node is StaticKeyword {
return node.kind === SyntaxKind.StaticKeyword;
}
/** @internal */
export function isAbstractModifier(node: Node): node is AbstractKeyword {
return node.kind === SyntaxKind.AbstractKeyword;
}
/** @internal */
export function isOverrideModifier(node: Node): node is OverrideKeyword {
return node.kind === SyntaxKind.OverrideKeyword;
}
/** @internal */
export function isAccessorModifier(node: Node): node is AccessorKeyword {
return node.kind === SyntaxKind.AccessorKeyword;
}
/** @internal */
export function isSuperKeyword(node: Node): node is SuperExpression {
return node.kind === SyntaxKind.SuperKeyword;
}
/** @internal */
export function isImportKeyword(node: Node): node is ImportExpression {
return node.kind === SyntaxKind.ImportKeyword;
}
/** @internal */
export function isCaseKeyword(node: Node): node is CaseKeyword {
return node.kind === SyntaxKind.CaseKeyword;
}
// Names
export function isQualifiedName(node: Node): node is QualifiedName {
return node.kind === SyntaxKind.QualifiedName;
}
export function isComputedPropertyName(node: Node): node is ComputedPropertyName {
return node.kind === SyntaxKind.ComputedPropertyName;
}
// Signature elements
export function isTypeParameterDeclaration(node: Node): node is TypeParameterDeclaration {
return node.kind === SyntaxKind.TypeParameter;
}
// TODO(rbuckton): Rename to 'isParameterDeclaration'
export function isParameter(node: Node): node is ParameterDeclaration {
return node.kind === SyntaxKind.Parameter;
}
export function isDecorator(node: Node): node is Decorator {
return node.kind === SyntaxKind.Decorator;
}
// TypeMember
export function isPropertySignature(node: Node): node is PropertySignature {
return node.kind === SyntaxKind.PropertySignature;
}
export function isPropertyDeclaration(node: Node): node is PropertyDeclaration {
return node.kind === SyntaxKind.PropertyDeclaration;
}
export function isMethodSignature(node: Node): node is MethodSignature {
return node.kind === SyntaxKind.MethodSignature;
}
export function isMethodDeclaration(node: Node): node is MethodDeclaration {
return node.kind === SyntaxKind.MethodDeclaration;
}
export function isClassStaticBlockDeclaration(node: Node): node is ClassStaticBlockDeclaration {
return node.kind === SyntaxKind.ClassStaticBlockDeclaration;
}
export function isConstructorDeclaration(node: Node): node is ConstructorDeclaration {
return node.kind === SyntaxKind.Constructor;
}
export function isGetAccessorDeclaration(node: Node): node is GetAccessorDeclaration {
return node.kind === SyntaxKind.GetAccessor;
}
export function isSetAccessorDeclaration(node: Node): node is SetAccessorDeclaration {
return node.kind === SyntaxKind.SetAccessor;
}
export function isCallSignatureDeclaration(node: Node): node is CallSignatureDeclaration {
return node.kind === SyntaxKind.CallSignature;
}
export function isConstructSignatureDeclaration(node: Node): node is ConstructSignatureDeclaration {
return node.kind === SyntaxKind.ConstructSignature;
}
export function isIndexSignatureDeclaration(node: Node): node is IndexSignatureDeclaration {
return node.kind === SyntaxKind.IndexSignature;
}
// Type
export function isTypePredicateNode(node: Node): node is TypePredicateNode {
return node.kind === SyntaxKind.TypePredicate;
}
export function isTypeReferenceNode(node: Node): node is TypeReferenceNode {
return node.kind === SyntaxKind.TypeReference;
}
export function isFunctionTypeNode(node: Node): node is FunctionTypeNode {
return node.kind === SyntaxKind.FunctionType;
}
export function isConstructorTypeNode(node: Node): node is ConstructorTypeNode {
return node.kind === SyntaxKind.ConstructorType;
}
export function isTypeQueryNode(node: Node): node is TypeQueryNode {
return node.kind === SyntaxKind.TypeQuery;
}
export function isTypeLiteralNode(node: Node): node is TypeLiteralNode {
return node.kind === SyntaxKind.TypeLiteral;
}
export function isArrayTypeNode(node: Node): node is ArrayTypeNode {
return node.kind === SyntaxKind.ArrayType;
}
export function isTupleTypeNode(node: Node): node is TupleTypeNode {
return node.kind === SyntaxKind.TupleType;
}
export function isNamedTupleMember(node: Node): node is NamedTupleMember {
return node.kind === SyntaxKind.NamedTupleMember;
}
export function isOptionalTypeNode(node: Node): node is OptionalTypeNode {
return node.kind === SyntaxKind.OptionalType;
}
export function isRestTypeNode(node: Node): node is RestTypeNode {
return node.kind === SyntaxKind.RestType;
}
export function isUnionTypeNode(node: Node): node is UnionTypeNode {
return node.kind === SyntaxKind.UnionType;
}
export function isIntersectionTypeNode(node: Node): node is IntersectionTypeNode {
return node.kind === SyntaxKind.IntersectionType;
}
export function isConditionalTypeNode(node: Node): node is ConditionalTypeNode {
return node.kind === SyntaxKind.ConditionalType;
}
export function isInferTypeNode(node: Node): node is InferTypeNode {
return node.kind === SyntaxKind.InferType;
}
export function isParenthesizedTypeNode(node: Node): node is ParenthesizedTypeNode {
return node.kind === SyntaxKind.ParenthesizedType;
}
export function isThisTypeNode(node: Node): node is ThisTypeNode {
return node.kind === SyntaxKind.ThisType;
}
export function isTypeOperatorNode(node: Node): node is TypeOperatorNode {
return node.kind === SyntaxKind.TypeOperator;
}
export function isIndexedAccessTypeNode(node: Node): node is IndexedAccessTypeNode {
return node.kind === SyntaxKind.IndexedAccessType;
}
export function isMappedTypeNode(node: Node): node is MappedTypeNode {
return node.kind === SyntaxKind.MappedType;
}
export function isLiteralTypeNode(node: Node): node is LiteralTypeNode {
return node.kind === SyntaxKind.LiteralType;
}
export function isImportTypeNode(node: Node): node is ImportTypeNode {
return node.kind === SyntaxKind.ImportType;
}
export function isTemplateLiteralTypeSpan(node: Node): node is TemplateLiteralTypeSpan {
return node.kind === SyntaxKind.TemplateLiteralTypeSpan;
}
export function isTemplateLiteralTypeNode(node: Node): node is TemplateLiteralTypeNode {
return node.kind === SyntaxKind.TemplateLiteralType;
}
// Binding patterns
export function isObjectBindingPattern(node: Node): node is ObjectBindingPattern {
return node.kind === SyntaxKind.ObjectBindingPattern;
}
export function isArrayBindingPattern(node: Node): node is ArrayBindingPattern {
return node.kind === SyntaxKind.ArrayBindingPattern;
}
export function isBindingElement(node: Node): node is BindingElement {
return node.kind === SyntaxKind.BindingElement;
}
// Expression
export function isArrayLiteralExpression(node: Node): node is ArrayLiteralExpression {
return node.kind === SyntaxKind.ArrayLiteralExpression;
}
export function isObjectLiteralExpression(node: Node): node is ObjectLiteralExpression {
return node.kind === SyntaxKind.ObjectLiteralExpression;
}
export function isPropertyAccessExpression(node: Node): node is PropertyAccessExpression {
return node.kind === SyntaxKind.PropertyAccessExpression;
}
export function isElementAccessExpression(node: Node): node is ElementAccessExpression {
return node.kind === SyntaxKind.ElementAccessExpression;
}
export function isCallExpression(node: Node): node is CallExpression {
return node.kind === SyntaxKind.CallExpression;
}
export function isNewExpression(node: Node): node is NewExpression {
return node.kind === SyntaxKind.NewExpression;
}
export function isTaggedTemplateExpression(node: Node): node is TaggedTemplateExpression {
return node.kind === SyntaxKind.TaggedTemplateExpression;
}
export function isTypeAssertionExpression(node: Node): node is TypeAssertion {
return node.kind === SyntaxKind.TypeAssertionExpression;
}
export function isParenthesizedExpression(node: Node): node is ParenthesizedExpression {
return node.kind === SyntaxKind.ParenthesizedExpression;
}
export function isFunctionExpression(node: Node): node is FunctionExpression {
return node.kind === SyntaxKind.FunctionExpression;
}
export function isArrowFunction(node: Node): node is ArrowFunction {
return node.kind === SyntaxKind.ArrowFunction;
}
export function isDeleteExpression(node: Node): node is DeleteExpression {
return node.kind === SyntaxKind.DeleteExpression;
}
export function isTypeOfExpression(node: Node): node is TypeOfExpression {
return node.kind === SyntaxKind.TypeOfExpression;
}
export function isVoidExpression(node: Node): node is VoidExpression {
return node.kind === SyntaxKind.VoidExpression;
}
export function isAwaitExpression(node: Node): node is AwaitExpression {
return node.kind === SyntaxKind.AwaitExpression;
}
export function isPrefixUnaryExpression(node: Node): node is PrefixUnaryExpression {
return node.kind === SyntaxKind.PrefixUnaryExpression;
}
export function isPostfixUnaryExpression(node: Node): node is PostfixUnaryExpression {
return node.kind === SyntaxKind.PostfixUnaryExpression;
}
export function isBinaryExpression(node: Node): node is BinaryExpression {
return node.kind === SyntaxKind.BinaryExpression;
}
export function isConditionalExpression(node: Node): node is ConditionalExpression {
return node.kind === SyntaxKind.ConditionalExpression;
}
export function isTemplateExpression(node: Node): node is TemplateExpression {
return node.kind === SyntaxKind.TemplateExpression;
}
export function isYieldExpression(node: Node): node is YieldExpression {
return node.kind === SyntaxKind.YieldExpression;
}
export function isSpreadElement(node: Node): node is SpreadElement {
return node.kind === SyntaxKind.SpreadElement;
}
export function isClassExpression(node: Node): node is ClassExpression {
return node.kind === SyntaxKind.ClassExpression;
}
export function isOmittedExpression(node: Node): node is OmittedExpression {
return node.kind === SyntaxKind.OmittedExpression;
}
export function isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments {
return node.kind === SyntaxKind.ExpressionWithTypeArguments;
}
export function isAsExpression(node: Node): node is AsExpression {
return node.kind === SyntaxKind.AsExpression;
}
export function isSatisfiesExpression(node: Node): node is SatisfiesExpression {
return node.kind === SyntaxKind.SatisfiesExpression;
}
export function isNonNullExpression(node: Node): node is NonNullExpression {
return node.kind === SyntaxKind.NonNullExpression;
}
export function isMetaProperty(node: Node): node is MetaProperty {
return node.kind === SyntaxKind.MetaProperty;
}
export function isSyntheticExpression(node: Node): node is SyntheticExpression {
return node.kind === SyntaxKind.SyntheticExpression;
}
export function isPartiallyEmittedExpression(node: Node): node is PartiallyEmittedExpression {
return node.kind === SyntaxKind.PartiallyEmittedExpression;
}
export function isCommaListExpression(node: Node): node is CommaListExpression {
return node.kind === SyntaxKind.CommaListExpression;
}
// Misc
export function isTemplateSpan(node: Node): node is TemplateSpan {
return node.kind === SyntaxKind.TemplateSpan;
}
export function isSemicolonClassElement(node: Node): node is SemicolonClassElement {
return node.kind === SyntaxKind.SemicolonClassElement;
}
// Elements
export function isBlock(node: Node): node is Block {
return node.kind === SyntaxKind.Block;
}
export function isVariableStatement(node: Node): node is VariableStatement {
return node.kind === SyntaxKind.VariableStatement;
}
export function isEmptyStatement(node: Node): node is EmptyStatement {
return node.kind === SyntaxKind.EmptyStatement;
}
export function isExpressionStatement(node: Node): node is ExpressionStatement {
return node.kind === SyntaxKind.ExpressionStatement;
}
export function isIfStatement(node: Node): node is IfStatement {
return node.kind === SyntaxKind.IfStatement;
}
export function isDoStatement(node: Node): node is DoStatement {
return node.kind === SyntaxKind.DoStatement;
}
export function isWhileStatement(node: Node): node is WhileStatement {
return node.kind === SyntaxKind.WhileStatement;
}
export function isForStatement(node: Node): node is ForStatement {
return node.kind === SyntaxKind.ForStatement;
}
export function isForInStatement(node: Node): node is ForInStatement {
return node.kind === SyntaxKind.ForInStatement;
}
export function isForOfStatement(node: Node): node is ForOfStatement {
return node.kind === SyntaxKind.ForOfStatement;
}
export function isContinueStatement(node: Node): node is ContinueStatement {
return node.kind === SyntaxKind.ContinueStatement;
}
export function isBreakStatement(node: Node): node is BreakStatement {
return node.kind === SyntaxKind.BreakStatement;
}
export function isReturnStatement(node: Node): node is ReturnStatement {
return node.kind === SyntaxKind.ReturnStatement;
}
export function isWithStatement(node: Node): node is WithStatement {
return node.kind === SyntaxKind.WithStatement;
}
export function isSwitchStatement(node: Node): node is SwitchStatement {
return node.kind === SyntaxKind.SwitchStatement;
}
export function isLabeledStatement(node: Node): node is LabeledStatement {
return node.kind === SyntaxKind.LabeledStatement;
}
export function isThrowStatement(node: Node): node is ThrowStatement {
return node.kind === SyntaxKind.ThrowStatement;
}
export function isTryStatement(node: Node): node is TryStatement {
return node.kind === SyntaxKind.TryStatement;
}
export function isDebuggerStatement(node: Node): node is DebuggerStatement {
return node.kind === SyntaxKind.DebuggerStatement;
}
export function isVariableDeclaration(node: Node): node is VariableDeclaration {
return node.kind === SyntaxKind.VariableDeclaration;
}
export function isVariableDeclarationList(node: Node): node is VariableDeclarationList {
return node.kind === SyntaxKind.VariableDeclarationList;
}
export function isFunctionDeclaration(node: Node): node is FunctionDeclaration {
return node.kind === SyntaxKind.FunctionDeclaration;
}
export function isClassDeclaration(node: Node): node is ClassDeclaration {
return node.kind === SyntaxKind.ClassDeclaration;
}
export function isInterfaceDeclaration(node: Node): node is InterfaceDeclaration {
return node.kind === SyntaxKind.InterfaceDeclaration;
}
export function isTypeAliasDeclaration(node: Node): node is TypeAliasDeclaration {
return node.kind === SyntaxKind.TypeAliasDeclaration;
}
export function isEnumDeclaration(node: Node): node is EnumDeclaration {
return node.kind === SyntaxKind.EnumDeclaration;
}
export function isModuleDeclaration(node: Node): node is ModuleDeclaration {
return node.kind === SyntaxKind.ModuleDeclaration;
}
export function isModuleBlock(node: Node): node is ModuleBlock {
return node.kind === SyntaxKind.ModuleBlock;
}
export function isCaseBlock(node: Node): node is CaseBlock {
return node.kind === SyntaxKind.CaseBlock;
}
export function isNamespaceExportDeclaration(node: Node): node is NamespaceExportDeclaration {
return node.kind === SyntaxKind.NamespaceExportDeclaration;
}
export function isImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration {
return node.kind === SyntaxKind.ImportEqualsDeclaration;
}
export function isImportDeclaration(node: Node): node is ImportDeclaration {
return node.kind === SyntaxKind.ImportDeclaration;
}
export function isImportClause(node: Node): node is ImportClause {
return node.kind === SyntaxKind.ImportClause;
}
export function isImportTypeAssertionContainer(node: Node): node is ImportTypeAssertionContainer {
return node.kind === SyntaxKind.ImportTypeAssertionContainer;
}
/** @deprecated */
export function isAssertClause(node: Node): node is AssertClause {
return node.kind === SyntaxKind.AssertClause;
}
/** @deprecated */
export function isAssertEntry(node: Node): node is AssertEntry {
return node.kind === SyntaxKind.AssertEntry;
}
export function isImportAttributes(node: Node): node is ImportAttributes {
return node.kind === SyntaxKind.ImportAttributes;
}
export function isImportAttribute(node: Node): node is ImportAttribute {
return node.kind === SyntaxKind.ImportAttribute;
}
export function isNamespaceImport(node: Node): node is NamespaceImport {
return node.kind === SyntaxKind.NamespaceImport;
}
export function isNamespaceExport(node: Node): node is NamespaceExport {
return node.kind === SyntaxKind.NamespaceExport;
}
export function isNamedImports(node: Node): node is NamedImports {
return node.kind === SyntaxKind.NamedImports;
}
export function isImportSpecifier(node: Node): node is ImportSpecifier {
return node.kind === SyntaxKind.ImportSpecifier;
}
export function isExportAssignment(node: Node): node is ExportAssignment {
return node.kind === SyntaxKind.ExportAssignment;
}
export function isExportDeclaration(node: Node): node is ExportDeclaration {
return node.kind === SyntaxKind.ExportDeclaration;
}
export function isNamedExports(node: Node): node is NamedExports {
return node.kind === SyntaxKind.NamedExports;
}
export function isExportSpecifier(node: Node): node is ExportSpecifier {
return node.kind === SyntaxKind.ExportSpecifier;
}
export function isMissingDeclaration(node: Node): node is MissingDeclaration {
return node.kind === SyntaxKind.MissingDeclaration;
}
export function isNotEmittedStatement(node: Node): node is NotEmittedStatement {
return node.kind === SyntaxKind.NotEmittedStatement;
}
/** @internal */
export function isSyntheticReference(node: Node): node is SyntheticReferenceExpression {
return node.kind === SyntaxKind.SyntheticReferenceExpression;
}
// Module References
export function isExternalModuleReference(node: Node): node is ExternalModuleReference {
return node.kind === SyntaxKind.ExternalModuleReference;
}
// JSX
export function isJsxElement(node: Node): node is JsxElement {
return node.kind === SyntaxKind.JsxElement;
}
export function isJsxSelfClosingElement(node: Node): node is JsxSelfClosingElement {
return node.kind === SyntaxKind.JsxSelfClosingElement;
}
export function isJsxOpeningElement(node: Node): node is JsxOpeningElement {
return node.kind === SyntaxKind.JsxOpeningElement;
}
export function isJsxClosingElement(node: Node): node is JsxClosingElement {
return node.kind === SyntaxKind.JsxClosingElement;
}
export function isJsxFragment(node: Node): node is JsxFragment {
return node.kind === SyntaxKind.JsxFragment;
}
export function isJsxOpeningFragment(node: Node): node is JsxOpeningFragment {
return node.kind === SyntaxKind.JsxOpeningFragment;
}
export function isJsxClosingFragment(node: Node): node is JsxClosingFragment {
return node.kind === SyntaxKind.JsxClosingFragment;
}
export function isJsxAttribute(node: Node): node is JsxAttribute {
return node.kind === SyntaxKind.JsxAttribute;
}
export function isJsxAttributes(node: Node): node is JsxAttributes {
return node.kind === SyntaxKind.JsxAttributes;
}
export function isJsxSpreadAttribute(node: Node): node is JsxSpreadAttribute {
return node.kind === SyntaxKind.JsxSpreadAttribute;
}
export function isJsxExpression(node: Node): node is JsxExpression {
return node.kind === SyntaxKind.JsxExpression;
}
export function isJsxNamespacedName(node: Node): node is JsxNamespacedName {
return node.kind === SyntaxKind.JsxNamespacedName;
}
// Clauses
export function isCaseClause(node: Node): node is CaseClause {
return node.kind === SyntaxKind.CaseClause;
}
export function isDefaultClause(node: Node): node is DefaultClause {
return node.kind === SyntaxKind.DefaultClause;
}
export function isHeritageClause(node: Node): node is HeritageClause {
return node.kind === SyntaxKind.HeritageClause;
}
export function isCatchClause(node: Node): node is CatchClause {
return node.kind === SyntaxKind.CatchClause;
}
// Property assignments
export function isPropertyAssignment(node: Node): node is PropertyAssignment {
return node.kind === SyntaxKind.PropertyAssignment;
}
export function isShorthandPropertyAssignment(node: Node): node is ShorthandPropertyAssignment {
return node.kind === SyntaxKind.ShorthandPropertyAssignment;
}
export function isSpreadAssignment(node: Node): node is SpreadAssignment {
return node.kind === SyntaxKind.SpreadAssignment;