# JS Noob - does not understand error of monaco editor

**URL:** <https://discourse.nodered.org/t/js-noob-does-not-understand-error-of-monaco-editor/66576>\
**Category:** General\
**Created:** [17 August 2022 21:18 UTC](https://discourse.nodered.org/t/js-noob-does-not-understand-error-of-monaco-editor/66576 "2022-08-17T21:18:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [17 August 2022 21:18 UTC](https://discourse.nodered.org/t/js-noob-does-not-understand-error-of-monaco-editor/66576/1 "2022-08-17T21:18:53Z")

</div>

I have the following code:

```auto
client.reverse(msg.payload).then((/** @type {any} */ output) => {
    msg.payload = output;

    node.send(msg);
    node.done();
}).catch((/** @type {{ name: any; message: any; }} */ err) => {
    // An error has been returned by the Promise.
    // Do something with it...
    msg.payload = {
        name: err.name,
        message: err.message
    };
    node.send(msg);
    node.done();
});

```

If the comment is not added you get the following error or warning with the monaco editor:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/e/fe9f76371334288033a93de9d74b69f281b84d93.png)

With the quick fix a comment is added, but why does this fix the error. Sorry I am a noob in JS.

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [17 August 2022 22:37 UTC](https://discourse.nodered.org/t/js-noob-does-not-understand-error-of-monaco-editor/66576/2 "2022-08-17T22:37:54Z")

</div>

OK - i guess I found it out - it is something using JSDoc.

> **[Use JSDoc: @type](https://jsdoc.app/tags-type.html)**
>
> Document the type of an object.

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

However if you specify a wrong type in this description - no error is raised.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 August 2022 09:05 UTC](https://discourse.nodered.org/t/js-noob-does-not-understand-error-of-monaco-editor/66576/3 "2022-08-18T09:05:15Z")

</div>

That is not an error but rather a warning. Just ignore it if you know the data types are correct. Monaco/VScode does its best with data typing but sometimes it just can't work it out.

BTW, there is a known issue in Monaco when trying to force in-line JSDoc style typing. Generally you need to wrap the variable or statement you want to type in `( ... )` in order for Monaco to know that it should actually be applied.

---

<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:** [1 September 2022 09:05 UTC](https://discourse.nodered.org/t/js-noob-does-not-understand-error-of-monaco-editor/66576/4 "2022-09-01T09:05:36Z")

</div>

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