ts-morph
ts-morph copied to clipboard
[Question] query nested nodes
Thanks for this great library.
I'm wondering if there is any way to query nested children. If we take the following code:
someObject.someKey.someMethod()
And I want to get a reference to the someMethod Identifier. Currently, I need to perform many for loops to get this node.
Is there any easy way to do it with your library?
Thanks.
I think the closest thing is to use tsquery. See here: https://gist.github.com/dsherret/826fe77613be22676778b8c4ba7390e7
There's some past discussion in #585 and #351, but basically adding querying is something I don't want to do, though probably having better support for what's shown in that gist would be nice (so it's not using an internal method).