You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use types.xxxStatment.name from @babel/types to assign to traverse's visitor like below:
letparser=require('@babel/parser').parse;lettarvel=require('@babel/traverse').default;lett=require('@babel/types');conststr=` if ('1' === 2) console.log('test');`letast=parser(str);console.log(t.ifStatement.name);// ifStatementtarvel(ast,{[t.ifStatement.name](path){console.log('check if statement');}});
It was working fine before @babel/[email protected], while with 7.10, it throws the error: You gave us a visitor for the node type callExpression but it's not a valid type
nowaday, I have to capitalize the first letter of the name gets from @babel/types. wtf 🙂
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I use
types.xxxStatment.name
from@babel/types
to assign to traverse's visitor like below:It was working fine before
@babel/[email protected]
, while with 7.10, it throws the error:You gave us a visitor for the node type callExpression but it's not a valid type
nowaday, I have to capitalize the first letter of the name gets from @babel/types. wtf 🙂
help wanted :(
Beta Was this translation helpful? Give feedback.
All reactions