Closed
Description
For each TSEnumDeclaration
, we place its members directly on this AST node.
export interface TSEnumDeclaration extends BaseNode {
type: AST_NODE_TYPES.TSEnumDeclaration;
id: Identifier;
members: TSEnumMember[];
const?: boolean;
declare?: boolean;
modifiers?: Modifier[];
decorators?: Decorator[];
}
For each TSInterfaceDeclaration
, we have a separate TSInterfaceBody
node, upon which we place the members.
export interface TSInterfaceDeclaration extends BaseNode {
type: AST_NODE_TYPES.TSInterfaceDeclaration;
body: TSInterfaceBody;
id: Identifier;
typeParameters?: TSTypeParameterDeclaration;
extends?: ExpressionWithTypeArguments[];
implements?: ExpressionWithTypeArguments[];
decorators?: Decorator[];
abstract?: boolean;
declare?: boolean;
}
export interface TSInterfaceBody extends BaseNode {
type: AST_NODE_TYPES.TSInterfaceBody;
body: TypeElement[];
}
I'm not sure why there's this inconsistency between the two, but I think we should consider aligning the two.
I'm not sure why TSEnumDeclaration
was created without a body, but I think that creating a TSEnumBody
node seems like the correct thing to do.
Doing so would align it with not only TSInterfaceDeclaration
, but also TSModuleDeclaration
, ClassDeclaration
and FunctionDeclaration
.