Skip to content

Missing castings #37

@hugoattal

Description

@hugoattal

Describe the feature

Hey 🙂!

So I'd like to parse any code using builder.raw, but it fails on some castings.
For example, I'd like to generate foo(bar) (bar being a variable), doing it like this does not work:

builders.functionCall("foo", builders.raw("bar"));

Here are a few more examples.

const result = builders.raw("bar()");
console.log(generateCode(result)); // works
const result = builders.raw("bar"); // MagicastError: Casting "Identifier" is not supported
console.log(generateCode(result));
const result = builders.raw("() => 'a'"); // MagicastError: Casting "ArrowFunctionExpression" is not supported
console.log(generateCode(result));

I can help with the implementation if needed!

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions