On `ModuleDecl`
#8753
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm confused/annoyed at the design of
ModuleDecl
, which seems to be largely imported from estree. Ignoring things like spans and TypeScript, it basically boils down to:There are several points I'm confused about:
export {};
andexport {} from "...";
) joined? They have different both syntax and semantics. I imagine it makes parsing easier, though. If anything,import {} from "...";
andexport {} from "...";
are are quite similar.ExportDefaultDecl
andExportDefaultExpr
split? I don't understand whyexport default function () {};
wouldn't be aExportDefaultExpr
. Only complicating factor seems to beTsInterfaceDecl
, which I am not knowledgeable enough to speak about.Vec<Specifier>
scheme, rather than just fixed fields? It makes any processing require awkward loops.While I acknowledge that I may be oversimplifying certain parts, in my mind, the the ideal design would be something closer to
I believe this structure more closely reflects the actual set of allowed productions, making it less error-prone; and removing the
Vec<Specifier>
scheme makes it significantly easier to work with. The obvious downside is that it's a majorly breaking change.Should you judge this to be a worthwhile change, I would be willing to attempt to implement it.
Beta Was this translation helpful? Give feedback.
All reactions