@@ -616,6 +616,7 @@ namespace ts {
616
616
| CallExpression
617
617
| CallSignatureDeclaration
618
618
| ClassDeclaration
619
+ | ClassElement
619
620
| ClassExpression
620
621
| ClassLikeDeclaration
621
622
| ConstructSignatureDeclaration
@@ -716,14 +717,13 @@ namespace ts {
716
717
typeParameters ?: NodeArray < TypeParameterDeclaration > ;
717
718
parameters : NodeArray < ParameterDeclaration > ;
718
719
type ?: TypeNode ;
719
- questionToken ?: QuestionToken ;
720
720
}
721
721
722
- export interface CallSignatureDeclaration extends SignatureDeclaration {
722
+ export interface CallSignatureDeclaration extends SignatureDeclaration , TypeElement {
723
723
kind : SyntaxKind . CallSignature ;
724
724
}
725
725
726
- export interface ConstructSignatureDeclaration extends SignatureDeclaration {
726
+ export interface ConstructSignatureDeclaration extends SignatureDeclaration , TypeElement {
727
727
kind : SyntaxKind . ConstructSignature ;
728
728
}
729
729
@@ -762,15 +762,15 @@ namespace ts {
762
762
initializer ?: Expression ; // Optional initializer
763
763
}
764
764
765
- export interface PropertySignature extends DeclarationBase {
765
+ export interface PropertySignature extends TypeElement {
766
766
kind : SyntaxKind . PropertySignature | SyntaxKind . JSDocRecordMember ;
767
767
name : PropertyName ; // Declared property name
768
768
questionToken ?: QuestionToken ; // Present on optional property
769
769
type ?: TypeNode ; // Optional type annotation
770
770
initializer ?: Expression ; // Optional initializer
771
771
}
772
772
773
- export interface PropertyDeclaration extends DeclarationBase {
773
+ export interface PropertyDeclaration extends ClassElement {
774
774
kind : SyntaxKind . PropertyDeclaration ;
775
775
questionToken ?: QuestionToken ; // Present for use with reporting a grammar error
776
776
name : PropertyName ;
@@ -876,7 +876,7 @@ namespace ts {
876
876
body ?: FunctionBody ;
877
877
}
878
878
879
- export interface MethodSignature extends SignatureDeclaration {
879
+ export interface MethodSignature extends SignatureDeclaration , TypeElement {
880
880
kind : SyntaxKind . MethodSignature ;
881
881
name : PropertyName ;
882
882
}
@@ -890,28 +890,27 @@ namespace ts {
890
890
// Because of this, it may be necessary to determine what sort of MethodDeclaration you have
891
891
// at later stages of the compiler pipeline. In that case, you can either check the parent kind
892
892
// of the method, or use helpers like isObjectLiteralMethodDeclaration
893
- export interface MethodDeclaration extends FunctionLikeDeclaration , ObjectLiteralElement {
893
+ export interface MethodDeclaration extends FunctionLikeDeclaration , ClassElement , ObjectLiteralElement {
894
894
kind : SyntaxKind . MethodDeclaration ;
895
895
name : PropertyName ;
896
896
body ?: FunctionBody ;
897
897
}
898
898
899
- export interface ConstructorDeclaration extends FunctionLikeDeclaration {
899
+ export interface ConstructorDeclaration extends FunctionLikeDeclaration , ClassElement {
900
900
kind : SyntaxKind . Constructor ;
901
901
parent ?: ClassDeclaration | ClassExpression ;
902
902
body ?: FunctionBody ;
903
903
}
904
904
905
905
/** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */
906
- export interface SemicolonClassElement extends DeclarationBase {
906
+ export interface SemicolonClassElement extends ClassElement {
907
907
kind : SyntaxKind . SemicolonClassElement ;
908
908
parent ?: ClassDeclaration | ClassExpression ;
909
- name ?: PropertyName ;
910
909
}
911
910
912
911
// See the comment on MethodDeclaration for the intuition behind GetAccessorDeclaration being a
913
912
// ClassElement and an ObjectLiteralElement.
914
- export interface GetAccessorDeclaration extends FunctionLikeDeclaration , ObjectLiteralElement {
913
+ export interface GetAccessorDeclaration extends FunctionLikeDeclaration , ClassElement , ObjectLiteralElement {
915
914
kind : SyntaxKind . GetAccessor ;
916
915
parent ?: ClassDeclaration | ClassExpression | ObjectLiteralExpression ;
917
916
name : PropertyName ;
@@ -920,7 +919,7 @@ namespace ts {
920
919
921
920
// See the comment on MethodDeclaration for the intuition behind SetAccessorDeclaration being a
922
921
// ClassElement and an ObjectLiteralElement.
923
- export interface SetAccessorDeclaration extends FunctionLikeDeclaration , ObjectLiteralElement {
922
+ export interface SetAccessorDeclaration extends FunctionLikeDeclaration , ClassElement , ObjectLiteralElement {
924
923
kind : SyntaxKind . SetAccessor ;
925
924
parent ?: ClassDeclaration | ClassExpression | ObjectLiteralExpression ;
926
925
name : PropertyName ;
@@ -929,7 +928,7 @@ namespace ts {
929
928
930
929
export type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration ;
931
930
932
- export interface IndexSignatureDeclaration extends SignatureDeclaration {
931
+ export interface IndexSignatureDeclaration extends SignatureDeclaration , ClassElement , TypeElement {
933
932
kind : SyntaxKind . IndexSignature ;
934
933
parent ?: ClassDeclaration | ClassExpression | InterfaceDeclaration | TypeLiteralNode ;
935
934
}
@@ -1696,7 +1695,7 @@ namespace ts {
1696
1695
kind : SyntaxKind . DebuggerStatement ;
1697
1696
}
1698
1697
1699
- export interface MissingDeclaration extends DeclarationStatement , ObjectLiteralElement {
1698
+ export interface MissingDeclaration extends DeclarationStatement , ClassElement , ObjectLiteralElement , TypeElement {
1700
1699
kind : SyntaxKind . MissingDeclaration ;
1701
1700
name ?: Identifier ;
1702
1701
}
@@ -1864,26 +1863,34 @@ namespace ts {
1864
1863
kind : SyntaxKind . ClassExpression ;
1865
1864
}
1866
1865
1867
- export type ClassElement =
1868
- | PropertyDeclaration
1869
- | MethodDeclaration
1870
- | ConstructorDeclaration
1871
- | SemicolonClassElement
1872
- | GetAccessorDeclaration
1873
- | SetAccessorDeclaration
1874
- | IndexSignatureDeclaration
1875
- | MissingDeclaration ;
1866
+ export interface ClassElement extends DeclarationBase {
1867
+ kind :
1868
+ | SyntaxKind . PropertyDeclaration
1869
+ | SyntaxKind . MethodDeclaration
1870
+ | SyntaxKind . Constructor
1871
+ | SyntaxKind . SemicolonClassElement
1872
+ | SyntaxKind . GetAccessor
1873
+ | SyntaxKind . SetAccessor
1874
+ | SyntaxKind . IndexSignature
1875
+ | SyntaxKind . MissingDeclaration ;
1876
+ _classElementBrand : any ;
1877
+ name ?: PropertyName ;
1878
+ }
1876
1879
1877
- export type TypeElement =
1878
- | CallSignatureDeclaration
1879
- | ConstructSignatureDeclaration
1880
- | PropertySignature
1881
- | MethodSignature
1882
- | IndexSignatureDeclaration
1883
- | MissingDeclaration
1884
- | IndexSignatureDeclaration
1885
- | JSDocPropertyTag
1886
- | JSDocRecordMember ;
1880
+ export interface TypeElement extends DeclarationBase {
1881
+ kind :
1882
+ | SyntaxKind . CallSignature
1883
+ | SyntaxKind . ConstructSignature
1884
+ | SyntaxKind . PropertySignature
1885
+ | SyntaxKind . MethodSignature
1886
+ | SyntaxKind . IndexSignature
1887
+ | SyntaxKind . MissingDeclaration
1888
+ | SyntaxKind . JSDocPropertyTag
1889
+ | SyntaxKind . JSDocRecordMember ;
1890
+ _typeElementBrand : any ;
1891
+ name ?: PropertyName ;
1892
+ questionToken ?: QuestionToken ;
1893
+ }
1887
1894
1888
1895
export interface InterfaceDeclaration extends DeclarationStatement {
1889
1896
kind : SyntaxKind . InterfaceDeclaration ;
@@ -2217,7 +2224,7 @@ namespace ts {
2217
2224
jsDocTypeLiteral ?: JSDocTypeLiteral ;
2218
2225
}
2219
2226
2220
- export interface JSDocPropertyTag extends JSDocTag {
2227
+ export interface JSDocPropertyTag extends JSDocTag , TypeElement {
2221
2228
kind : SyntaxKind . JSDocPropertyTag ;
2222
2229
name : Identifier ;
2223
2230
typeExpression : JSDocTypeExpression ;
0 commit comments