# \[ANNOUNCE\] node-red-contrib-ts – TypeScript Node

**URL:** <https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852>\
**Category:** Share Your Nodes\
**Tags:** function-node\
**Created:** [27 August 2025 09:09 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852 "2025-08-27T09:09:42Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![benoitadam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/benoitadam/32/102997_2.png) [@benoitadam](https://discourse.nodered.org/u/benoitadam)\
**Post date:** [27 August 2025 09:09 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/1 "2025-08-27T09:09:42Z")

</div>

Hi everyone,

This is my first post here, so I’m not entirely sure about the usual way of announcing new nodes – apologies if I’m doing it wrong!

I’ve just released a new Node-RED node: **`node-red-contrib-ts`**.  
It lets you execute **TypeScript** directly in your flows with:

✅ **Monaco Editor** (same as VS Code, with IntelliSense)  
✅ **Real-time Type Checking**  
✅ **Async/Await Support**  
✅ **Two Execution Modes** – Fast (Function) or Secure (VM)

Full details on GitHub: [GitHub Repository](https://github.com/benoitadam/node-red-contrib-ts)

---

<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:** [27 August 2025 12:27 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/2 "2025-08-27T12:27:55Z")

</div>

Looks interesting. One thing though, your code examples aren't TypeScript are they? They appear to be standard modern Node.JS? Might be helpful to put in an example that shows a possible benefit of coding in TS rather than JS. 😃

---

<div class="post-metadata">

**Author:** ![benoitadam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/benoitadam/32/102997_2.png) [@benoitadam](https://discourse.nodered.org/u/benoitadam)\
**Post date:** [27 August 2025 13:13 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/3 "2025-08-27T13:13:21Z")

</div>

Thanks for the feedback! That’s a great point – the current examples are indeed quite close to modern JavaScript. I’ll add an example that highlights a real benefit of using TypeScript, such as explicit typing and IntelliSense/autocomplete support.  
I’ve also just updated the node so the editor now properly analyzes TypeScript during editing, with real-time type checking.

 ![typescript-validation](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/6/960c773e2490a89d2efa8ebbcd1d2440183e7b17.png)

---

<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:** [27 August 2025 13:18 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/4 "2025-08-27T13:18:28Z")

</div>

> [@benoitadam](#):
>
> explicit typing and IntelliSense/autocomplete support

Of course, both of these can be dealt with using JavaScript and JSDoc comments. 😃 So not unique to TS.

Also, I've found some areas of TS IntelliSense is pretty appalling. DOM API's being a particular case in point.

---

<div class="post-metadata">

**Author:** ![benoitadam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/benoitadam/32/102997_2.png) [@benoitadam](https://discourse.nodered.org/u/benoitadam)\
**Post date:** [27 August 2025 13:28 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/5 "2025-08-27T13:28:54Z")

</div>

You’re right, JSDoc helps, but TypeScript goes much further:  
✅ **Strict type checking before execution**  
✅ **Native support for interfaces and custom types**  
✅ **Full interoperability with Node.js and external libraries**

With **version 1.1.0** , the editor now properly analyzes TypeScript with **real-time type checking** , just like in VS Code. This makes the benefits much clearer in Node-RED.

---

<div class="post-metadata">

**Author:** ![benoitadam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/benoitadam/32/102997_2.png) [@benoitadam](https://discourse.nodered.org/u/benoitadam)\
**Post date:** [27 August 2025 13:34 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/6 "2025-08-27T13:34:30Z")

</div>

Here’s a quick example to show the difference:

Without TypeScript (no error detected):

 ![Capture d’écran 2025-08-27 à 15.32.08](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/6/c6d8a677d8e1b6e258c21d5cc2462d8d7dbbc3e0.png)

With TypeScript (error detected in real-time):

 ![Capture d’écran 2025-08-27 à 15.31.12](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/0/60165da8f6ffc675b94cdb5f92abdfeb47697fb6.png)

---

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [27 August 2025 14:29 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/7 "2025-08-27T14:29:42Z")

</div>

What if you update the core node to add a flag that would enable typescript?

---

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [27 August 2025 14:47 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/8 "2025-08-27T14:47:52Z")

</div>

I would add a new tab where users can configure json schemas for the msg and config objects. These schemas are turned automatically into types which are injected in monaco. With this, Users can type `msg.` and monaco will show them the props available in msg or config objects. Why using schemas and not just types directly? Because typescript alone doesnt validate data at runtime. With json schemas you can run a validation before handing the data over to the node.

Use ajv + typebox instead of zod for runtime validations because it is faster.

You can take a look how runtime validation can be done with ajv here [GitHub - AllanOricil/node-red-vue-template: Write Node-RED nodes using Vue and Typescript](https://github.com/AllanOricil/node-red-vue-template)

---

<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:** [27 August 2025 16:50 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/9 "2025-08-27T16:50:50Z")

</div>

Apologies for seemingly being a bit argumentative. I'd just like people to recognise both the strengths and weaknesses of JS vs TS.

> [@benoitadam](#):
>
> Strict type checking before execution

Are you running the node through a TS compiler? I know that Node.js is introducing "native" TS execution but I believe that they are "simply" (not actually simple at all I'm sure) removing the type annotations at execution time?

> [@benoitadam](#):
>
> Native support for interfaces and custom types

Not sure about interface definitions. Personally, I've always found those to get in the way rather than help but then I have never been a professional JS/TS programmer in an enterprise environment where I think that they might actually be helpful rather than just an overhead.

Custom types can, of course, be defined in JSDoc quite easily.

> [@benoitadam](#):
>
> Full interoperability with Node.js and external libraries

Would you mind explaining this one? I'm not sure what you mean.

> [@benoitadam](#):
>
> With TypeScript (error detected in real-time):

This is certainly easier to do in TS than with JSDoc, that's for sure.

This _should_ work, it works in VS Code:

```js
/**
 * @typedef {object} Page
 * @property {string} path - File path of the page
 * @property {string} name - Generated name of the page (format: "pagesN.jpg")
 * @property {number} width - Width of the page in pixels
 * @property {number} height - Height of the page in pixels
 * @property {number} bytes - Size of the page in bytes
 * @property {string} type - MIME type of the page (always "image/jpeg")
 */

const pages = (msg.payload)
    .filter( l => 1.trim())
    .map( (line, i) => {
        const [path, width, height, size] = line.split(' ; ')
        /** @type {Page} */
        return {
            path,
            name: `pages${i + 1}.jpg`,
            width: Number(width),
            height: Number(height),
            bytes: Number(size),
            type: 'image/jpeg'
        }
    })

pages[0].name = 2

```

In VS Code it does give the realtime error. But I think it only works there because it needs the ESLINT extensions and config.

Urm, actually, you don't need the type definition, it works without as long as ESLINT is configured correctly.

> [@AllanOricil](#):
>
> I would add a new tab where users can configure json schemas for the msg and config objects.

That seems like an interesting idea.

---

<div class="post-metadata">

**Author:** ![benoitadam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/benoitadam/32/102997_2.png) [@benoitadam](https://discourse.nodered.org/u/benoitadam)\
**Post date:** [27 August 2025 17:04 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/10 "2025-08-27T17:04:23Z")

</div>

If the Node-RED team wants to integrate this approach into the core function node, they  
can reuse my code - it's open source and modular.

> <https://github.com/benoitadam/node-red-contrib-ts/blob/main/src/typescript-node.ts>

---

<div class="post-metadata">

**Author:** ![benoitadam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/benoitadam/32/102997_2.png) [@benoitadam](https://discourse.nodered.org/u/benoitadam)\
**Post date:** [27 August 2025 17:09 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/11 "2025-08-27T17:09:36Z")

</div>

> users can configure json schemas for the msg and config objects

Excellent idea! I love the approach of JSON schemas → automatic TypeScript types.

> Use ajv + typebox instead of zod for runtime validations because it is faster.

I'll study Allan Oricil's GitHub reference and explore how to integrate this cleanly into a configuration tab.

Thanks for this very insightful technical suggestion! 🚀

---

<div class="post-metadata">

**Author:** ![benoitadam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/benoitadam/32/102997_2.png) [@benoitadam](https://discourse.nodered.org/u/benoitadam)\
**Post date:** [27 August 2025 17:24 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/12 "2025-08-27T17:24:26Z")

</div>

> [@TotallyInformation](#):
>
> Apologies for seemingly being a bit argumentative. I'd just like people to recognise both the strengths and weaknesses of JS vs TS.

No worries about being argumentative - these are excellent technical questions!

Maybe add both options? Let users choose between:

- TypeScript mode (what I have now)
- JSDoc mode (with ESLINT is configured correctly)

> [@TotallyInformation](#):
>
> Are you running the node through a TS compiler?

Yes, I'm using TypeScript's transpiler (with cache) to compile TS → JS before execution. The type checking happens at "design time" in Monaco, not runtime.

> [@TotallyInformation](#):
>
> > [@benoitadam](#):
> >
> > Full interoperability with Node.js and external libraries
> 
> Would you mind explaining this one? I'm not sure what you mean.

TypeScript has excellent support for Node.js built-ins and npm packages through `@types/*` packages. For example: `fs`, `path`, `crypto` etc. are fully typed. Many libraries are coded in typescript, we can copy TS or JS into node script input without conversion.

Thx

---

<div class="post-metadata">

**Author:** ![crisconru](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/crisconru/32/38995_2.png) [@crisconru](https://discourse.nodered.org/u/crisconru)\
**Post date:** [3 September 2025 17:58 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/13 "2025-09-03T17:58:09Z")

</div>

> [@benoitadam](#):
>
> Let users choose

That’s the point. If you add TypeScript support you can still code with JavaScript. It is becoming like a standard, it gives a better DX (sorry but JSDoc does not give the same DX, it is verbose compared to TypeScript). I don't know why there is still discussion about TypeScript or not. Even NodeJS is in the process to accept TypeScript. It is like trying to put doors on the field...

---

<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:** [3 September 2025 20:16 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/14 "2025-09-03T20:16:28Z")

</div>

> [@crisconru](#):
>
> don't know why there is still discussion about TypeScript or not.

Maybe because TS is twice the work for most things. More like having to code in C++ and if you are going to do that, you might as well do it. I don't want to have to generate 2 files for every 1 that I create in JS.

Neither do I want to have to do a build every time I change something.

> [@crisconru](#):
>
> Even NodeJS is in the process to accept TypeScript.

But they aren't really, are they. They are simply type stripping and so turning it back into JavaScript again in a rather brute-force way.

As I say, TS certainly has some advantages in certain circumstances. But I would argue that probably by far the majority of Node-RED users - even the majority of custom node creators - do not know or need or want TS.

The whole point - for me - of sticking with a tool like Node-RED is that it uses the same language as the web does. That was why I switched from PHP to Node.js for back-end programming in the first place. I am not a professional, full-time developer and I don't want all the overheads of TS.

If ever Node-RED switched to only TS, I would leave the platform as a node developer. What's more, it is already hard enough to contribute to core, TS would make that bar even higher for most of us.

That isn't to say that some parts of NR might not benefit from some TS love - I expect they might. Just that it feels extremely important to me that JavaScript developers are not crowded out by TS.

---

<div class="post-metadata">

**Author:** ![crisconru](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/crisconru/32/38995_2.png) [@crisconru](https://discourse.nodered.org/u/crisconru)\
**Post date:** [4 September 2025 03:39 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/15 "2025-09-04T03:39:00Z")

</div>

By parts:

> [@TotallyInformation](#):
>
> I don't want to have to generate 2 files for every 1 that I create in JS

You are not generating, it is a tool which makes this by you. Like when you uses babel / swc, etc

> [@TotallyInformation](#):
>
> Neither do I want to have to do a build every time I change something.

It is almost transparent and it gives you errors feedback

> [@TotallyInformation](#):
>
> But they aren't really, are they. They are simply type stripping and so turning it back into JavaScript again in a rather brute-force way.

They are doing just the first step, but they are on the way to support TS because if not the runtime will be old fashioned compared to the alternatives (Deno and Bun). Like CJS and ESM, Node said it was impossible to mix then because one is sync and the another is async and surprise surprise, they found a way to make it possible because ESM is the standard and the other alternatives make you transparent and painless.

> [@TotallyInformation](#):
>
> But I would argue that probably by far the majority of Node-RED users - even the majority of custom node creators - do not know or need or want TS.

I don't buy that. TypeScript is a superset of JS, not another language. The learning curve is almost flat, because is JavaScript with more "optional" features, because in a TypeScript you can code just with JavaScript. But if you add types and more features it only gives better developer experience to users, because you have better autocomplete, better error feedback, etc. Even for just regular users, they are going to have a better experience coding.

> [@TotallyInformation](#):
>
> The whole point - for me - of sticking with a tool like Node-RED is that it uses the same language as the web does.

TypeScript is JavaScript...

> [@TotallyInformation](#):
>
> I am not a professional, full-time developer

Your experience does not said that

> [@TotallyInformation](#):
>
> I don't want all the overheads of TS

Almost nothing and most devs don't have to be worried, only if you need a performantic code (which is not your case because you said you are not a professional full-time developer)

> [@TotallyInformation](#):
>
> f ever Node-RED switched to only TS, I would leave the platform as a node developer

Start saying that and not

> [@TotallyInformation](#):
>
> What's more, it is already hard enough to contribute to core, TS would make that bar even higher for most of us.

Au contraire, because as I said many times, TypeScript is JavaScript + it forces you to have a better and readable code (could you do a mess in TS? Of course, but it is harder than in JS because you have a compiler telling a ton fo things you are doing wrong).

> [@TotallyInformation](#):
>
> Just that it feels extremely important to me that JavaScript developers are not crowded out by TS.

Most JavaScript developers are switching to TypeScript because they are no crowded out by it. Actually you are adding a better experience to code in JavaScript. TypeScript is not another language, is a superset of JavaScript. In a TypeScript file you can just type JavaScript is completely fine. Let the user choose. If TypeScript support is added you are not wiped out by it, you can still code just in JavaScript, not adding TS is a way wiped out people.

Those reasons before are tough to buy because they didn't represent the real world. They sound more like a barrier which hide another real reasons like the language (TS) it is owned by a "not so good / ethical company" or kind of. Reasons which may have sense (and probably I agree with them) but the state of the art is the state of the art.

TypeScript is the present in the JavaScript ecosystem. Like the wave of JavaScript tooling made with Rust. Being against that is putting the pavement to make Node-RED a stagnant tool.

---

<div class="post-metadata">

**Author:** ![crisconru](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/crisconru/32/38995_2.png) [@crisconru](https://discourse.nodered.org/u/crisconru)\
**Post date:** [4 September 2025 04:50 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/16 "2025-09-04T04:50:08Z")

</div>

Congratulations @benoitadam

I have demanded to index your repo in DeepWiki. Now it is indexed (I hope you don't mind)

> **[benoitadam/node-red-contrib-ts | DeepWiki](https://deepwiki.com/benoitadam/node-red-contrib-ts)**
>
> This document provides a comprehensive introduction to \`node-red-contrib-ts\`, explaining its purpose, key features, architecture, and benefits for Node-RED developers. For detailed installation instru

---

<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:** [4 September 2025 09:21 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/17 "2025-09-04T09:21:53Z")

</div>

I'm not here to argue. I have put across my points and made my position clear.

---

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [4 September 2025 10:30 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ts-typescript-node/98852/18 "2025-09-04T10:30:10Z")

</div>

I liked this DeepWiki! I tried with one of my complex repos and it didnt work that well. It doesn't understand c/c++ files apparently

> **[AllanOricil/esp32-mfa-authenticator | DeepWiki](https://deepwiki.com/AllanOricil/esp32-mfa-authenticator)**
>
> This document provides a comprehensive overview of the ESP32 MFA Authenticator project, a hardware-based Time-based One-Time Password (TOTP) generator with web management capabilities. The system runs
