Skip to content

【question】Is ast-types not compatible with estree? #953

@alamhubb

Description

@alamhubb

Hello, I now have a custom extended estreeAst, which extends some custom ast types. I need to convert the extended ast to the estree standard ast. I am looking for an open source library that can achieve this function. I learned about ast-types,

builders.stringLiteral

But I found that there is no stringLiteral in estreeAst, but Literals that are uniformly used for stringLiteral, numberLiteral, etc.

Also

estree2022

extend interface ClassBody {
    body: [ MethodDefinition | PropertyDefinition | StaticBlock ];
}

ast-types

interface ClassBody extends Omit<Declaration, "type"> {
        type: "ClassBody";
        body: (K.MethodDefinitionKind | K.VariableDeclaratorKind | K.ClassPropertyDefinitionKind | K.ClassPropertyKind | K.ClassPrivatePropertyKind | K.ClassAccessorPropertyKind | K.ClassMethodKind | K.ClassPrivateMethodKind | K.StaticBlockKind | K.TSDeclareMethodKind | K.TSCallSignatureDeclarationKind | K.TSConstructSignatureDeclarationKind | K.TSIndexSignatureKind | K.TSMethodSignatureKind | K.TSPropertySignatureKind)[];
    }

I found that the node names in ast-types are inconsistent with those in estree, so I am a little confused. I hope to get your reply. Thank you.

I apologize if I disturbed you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions