Okay, what type would you specify if you were writing documentation? What type should the jsx code be?
I can say that you can use the following:
// The compiler will convert this to js:
// Also, all of the above is equal to an object:
I think in the case of Figma the type is really a union of all node types (e.g. Frame, Text, Rectangle etc.).
Then, in essence the type is just an Object with some specific properties.
So, if I want I can make a little converter that creates specific objects for each Figma node type (e.g. Frame) from strings as long as they match any of the Figma node types and pass them to the figma.createNodeFromJSXAsync method.
The reason for that was that I need the JSX structure to come from a service via an API call.
Thanks for the help, in the end I chose to not use the figma.createNodeFromJSXAsync method and write my own API to convert the JSX string input to Figma nodes.
This allows me to be more subjective with the JSX syntax so that I can pass html arguments on the JSX nodes that are specific to the logic of my plugin.