TSDeclareMethod embedded in MethodDefinition nodes #40
jsinterface
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm writing a function to prune typescript nodes from the Acorn AST and leave the vanilla ESTree behind, to be compatible with serializers such as Astring. I'm noticing that dropping TSDeclareMethod nodes leave behind their parent MethodDefinition nodes without a "value" field, which causes Astring to break. I haven't ever been able to find a good resource for TS-AST node specifications, so i don't know if this conforms to it or not, but wouldn't TSDeclareMethod nodes be better indicated at their MethodDefinition parents instead (as TSMethodDefinition)? These definitions never get a method body ("value" expression), and their lexical
corresponding to the supposed MethodDefinition after pruning the AST of a
is never actually a valid ecmascript node. (source: rollup/src/utils/PluginDriver.ts)
Am I wrong that this should be the specification, or is it only an implementation error that can be fixed here? I haven't been able to find typescript's Estree-compatible AST specification to tell. I assume it would be a part of typescript-eslint instead of typescript itself, if it exists.
I might also take this opportunity to ask generally how literal you meant the "experimental" attribute of this repo in the readme. I observe that this fills a huge gap created by typescript's lack of native ESTree support, typescript-eslint being the only backwards-engineered (plus being a wrapper around typescript it's the opposite of modular) substitute. It would be good to establish long-term support for this (I have been trying to adopt patternfly's discontinued acorn-typescript plugin myself after this report of mine, but it's pretty much dead in the water now having hit some hardly anymore tracable conflicts in the acorn/plugin inheritence, so much congrats to you for building it up successfully).
Beta Was this translation helpful? Give feedback.
All reactions