Add Types to the message payload

Hey there,

I'm loving the new monaco editor that was released in node-red v2. It seems like the msg.payload now has an "any" type:

I'm wondering if there is a way that we could type the msg.payload coming in if we have more information about it. Say if we knew the msg.payload was an object with the following structure:
{name: string, age: number} is there a way we could get that to show up in the auto-complete?

Thanks!

No. Because the function node has no way of knowing what is coming. Node-red nodes have no means of telling connected nodes what they send. Even if they did, what happens if you connected 2 it more wires.

What you can do though, is use jsdoc to describe a variable & you will get auto completion. Unfortunately, this is per editor, not global.

example...