@@ -616,6 +616,7 @@ namespace ts {
616616 | CallExpression
617617 | CallSignatureDeclaration
618618 | ClassDeclaration
619+ | ClassElement
619620 | ClassExpression
620621 | ClassLikeDeclaration
621622 | ConstructSignatureDeclaration
@@ -716,14 +717,13 @@ namespace ts {
716717 typeParameters ?: NodeArray < TypeParameterDeclaration > ;
717718 parameters : NodeArray < ParameterDeclaration > ;
718719 type ?: TypeNode ;
719- questionToken ?: QuestionToken ;
720720 }
721721
722- export interface CallSignatureDeclaration extends SignatureDeclaration {
722+ export interface CallSignatureDeclaration extends SignatureDeclaration , TypeElement {
723723 kind : SyntaxKind . CallSignature ;
724724 }
725725
726- export interface ConstructSignatureDeclaration extends SignatureDeclaration {
726+ export interface ConstructSignatureDeclaration extends SignatureDeclaration , TypeElement {
727727 kind : SyntaxKind . ConstructSignature ;
728728 }
729729
@@ -762,15 +762,15 @@ namespace ts {
762762 initializer ?: Expression ; // Optional initializer
763763 }
764764
765- export interface PropertySignature extends DeclarationBase {
765+ export interface PropertySignature extends TypeElement {
766766 kind : SyntaxKind . PropertySignature | SyntaxKind . JSDocRecordMember ;
767767 name : PropertyName ; // Declared property name
768768 questionToken ?: QuestionToken ; // Present on optional property
769769 type ?: TypeNode ; // Optional type annotation
770770 initializer ?: Expression ; // Optional initializer
771771 }
772772
773- export interface PropertyDeclaration extends DeclarationBase {
773+ export interface PropertyDeclaration extends ClassElement {
774774 kind : SyntaxKind . PropertyDeclaration ;
775775 questionToken ?: QuestionToken ; // Present for use with reporting a grammar error
776776 name : PropertyName ;
@@ -876,7 +876,7 @@ namespace ts {
876876 body ?: FunctionBody ;
877877 }
878878
879- export interface MethodSignature extends SignatureDeclaration {
879+ export interface MethodSignature extends SignatureDeclaration , TypeElement {
880880 kind : SyntaxKind . MethodSignature ;
881881 name : PropertyName ;
882882 }
@@ -890,28 +890,27 @@ namespace ts {
890890 // Because of this, it may be necessary to determine what sort of MethodDeclaration you have
891891 // at later stages of the compiler pipeline. In that case, you can either check the parent kind
892892 // of the method, or use helpers like isObjectLiteralMethodDeclaration
893- export interface MethodDeclaration extends FunctionLikeDeclaration , ObjectLiteralElement {
893+ export interface MethodDeclaration extends FunctionLikeDeclaration , ClassElement , ObjectLiteralElement {
894894 kind : SyntaxKind . MethodDeclaration ;
895895 name : PropertyName ;
896896 body ?: FunctionBody ;
897897 }
898898
899- export interface ConstructorDeclaration extends FunctionLikeDeclaration {
899+ export interface ConstructorDeclaration extends FunctionLikeDeclaration , ClassElement {
900900 kind : SyntaxKind . Constructor ;
901901 parent ?: ClassDeclaration | ClassExpression ;
902902 body ?: FunctionBody ;
903903 }
904904
905905 /** 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 {
907907 kind : SyntaxKind . SemicolonClassElement ;
908908 parent ?: ClassDeclaration | ClassExpression ;
909- name ?: PropertyName ;
910909 }
911910
912911 // See the comment on MethodDeclaration for the intuition behind GetAccessorDeclaration being a
913912 // ClassElement and an ObjectLiteralElement.
914- export interface GetAccessorDeclaration extends FunctionLikeDeclaration , ObjectLiteralElement {
913+ export interface GetAccessorDeclaration extends FunctionLikeDeclaration , ClassElement , ObjectLiteralElement {
915914 kind : SyntaxKind . GetAccessor ;
916915 parent ?: ClassDeclaration | ClassExpression | ObjectLiteralExpression ;
917916 name : PropertyName ;
@@ -920,7 +919,7 @@ namespace ts {
920919
921920 // See the comment on MethodDeclaration for the intuition behind SetAccessorDeclaration being a
922921 // ClassElement and an ObjectLiteralElement.
923- export interface SetAccessorDeclaration extends FunctionLikeDeclaration , ObjectLiteralElement {
922+ export interface SetAccessorDeclaration extends FunctionLikeDeclaration , ClassElement , ObjectLiteralElement {
924923 kind : SyntaxKind . SetAccessor ;
925924 parent ?: ClassDeclaration | ClassExpression | ObjectLiteralExpression ;
926925 name : PropertyName ;
@@ -929,7 +928,7 @@ namespace ts {
929928
930929 export type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration ;
931930
932- export interface IndexSignatureDeclaration extends SignatureDeclaration {
931+ export interface IndexSignatureDeclaration extends SignatureDeclaration , ClassElement , TypeElement {
933932 kind : SyntaxKind . IndexSignature ;
934933 parent ?: ClassDeclaration | ClassExpression | InterfaceDeclaration | TypeLiteralNode ;
935934 }
@@ -1696,7 +1695,7 @@ namespace ts {
16961695 kind : SyntaxKind . DebuggerStatement ;
16971696 }
16981697
1699- export interface MissingDeclaration extends DeclarationStatement , ObjectLiteralElement {
1698+ export interface MissingDeclaration extends DeclarationStatement , ClassElement , ObjectLiteralElement , TypeElement {
17001699 kind : SyntaxKind . MissingDeclaration ;
17011700 name ?: Identifier ;
17021701 }
@@ -1864,26 +1863,34 @@ namespace ts {
18641863 kind : SyntaxKind . ClassExpression ;
18651864 }
18661865
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+ }
18761879
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+ }
18871894
18881895 export interface InterfaceDeclaration extends DeclarationStatement {
18891896 kind : SyntaxKind . InterfaceDeclaration ;
@@ -2217,7 +2224,7 @@ namespace ts {
22172224 jsDocTypeLiteral ?: JSDocTypeLiteral ;
22182225 }
22192226
2220- export interface JSDocPropertyTag extends JSDocTag {
2227+ export interface JSDocPropertyTag extends JSDocTag , TypeElement {
22212228 kind : SyntaxKind . JSDocPropertyTag ;
22222229 name : Identifier ;
22232230 typeExpression : JSDocTypeExpression ;
0 commit comments