Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including tnode with all npm packages installed. Try it out:

var tnode = require("tnode")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

tnode v0.1.1

Run Flow type annotated code in node.

tnode

Run Flow type annotated code in node

tnode is a very light wrapper around your node executable that strips Flow type annotation syntax from your code before calling into node.

You use it exactly like the regular node executable.

How does this magic work?

tnode invokes a node instance with a patched require.extensions['.js'] function, which strips type annotations from your code.

Under the hood, this command:

$ tnode foo.js all the args

Turns into something like this:

$ TNODE_ENTRY_POINT=foo.js node fallback.js all the args

Installation

Install the tnode executable via npm:

$ npm install -g tnode

Programmatic API

You can also just require('tnode') in a script _without any annotations, and then require() any other .js file that has annotations after that.

require('tnode');
var wow = require('./someTypedCode');
// etc…

Thanks to gnode!

This is a fork of gnode that is modified to work with Flow type syntax.

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free