# Add Types to the message payload

**URL:** <https://discourse.nodered.org/t/add-types-to-the-message-payload/50984>\
**Category:** General\
**Created:** [13 September 2021 21:08 UTC](https://discourse.nodered.org/t/add-types-to-the-message-payload/50984 "2021-09-13T21:08:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tnrich](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tnrich/32/47942_2.png) [@tnrich](https://discourse.nodered.org/u/tnrich)\
**Post date:** [13 September 2021 21:08 UTC](https://discourse.nodered.org/t/add-types-to-the-message-payload/50984/1 "2021-09-13T21:08:38Z")

</div>

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:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/b/9bd21b258513db67f64d1ef7547bb268ce9823e7.png)

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!

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [13 September 2021 21:37 UTC](https://discourse.nodered.org/t/add-types-to-the-message-payload/50984/2 "2021-09-13T21:37:37Z")

</div>

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](https://jsdoc.app/) to describe a variable & you will get auto completion. Unfortunately, this is per editor, not global.

example...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/4/54ee6a3ffca9f9ed36738408ac998f398e44e6b4.png)

---

<div class="post-metadata">

**Author:** ![tnrich](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tnrich/32/47942_2.png) [@tnrich](https://discourse.nodered.org/u/tnrich)\
**Post date:** [23 September 2021 21:59 UTC](https://discourse.nodered.org/t/add-types-to-the-message-payload/50984/3 "2021-09-23T21:59:46Z")

</div>

Thanks @Steve-Mcl . That's too bad but I guess just a limitation of the system for now.

Cheers,  
Thomas

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 October 2021 21:59 UTC](https://discourse.nodered.org/t/add-types-to-the-message-payload/50984/4 "2021-10-07T21:59:47Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
