-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeGuard for all nodes with a .expression? #187
Comments
You're right, this is very common. I'll make all the nodes that have this an |
This can be used to tell if a node has a .getExpression function or not.
@gregjacobs I added The second check is necessary because I'm running a new release now. |
Awesome, thanks man! |
This can be used to tell if a node has a .getExpression function or not.
Hey David,
Was just working on some AST transforms, and I noticed a pattern that I want to try to take advantage of.
I'm basically trying to replace identifiers such as
myVar
withthis.myVar
. I noticed that I basically need to find compiler nodes which have anexpression
property that contain anIdentifier
node.For example,
CallExpression
,PropertyAccessExpression
,IfStatement
, and probably many more have anexpression
property. Was thinking I could transform them with something like this:Btw, any general thoughts on this? Is there a better way to go about this?
The text was updated successfully, but these errors were encountered: