It seems that path.insertAfter(), path.insertBefore(), path.unshiftContainer(), and path.pushContainer() only work with Statements. How do you insert nodes that are not Statements?
In my case I am writing a babel jsx plugin and I am trying to insert a sibling node which is a JSXExpressionContainer. When I do this I get the following error:
TypeError: Property body[0] of BlockStatement expected node to be of a type ["Statement"] but instead got "JSXExpressionContainer"
How do I fix this?
From the documentation here:
Looking at your error, make sure you do your types correctly. Just check babel types here and see what parameters are needed by each type.