Nodejs: TypeScript: hello, world!

Ubuntu names the node.js program 'nodejs' instead of 'node'

After using the node.js package manager (npm) to install TypeScript in Ubuntu 16.04LTS, I had a /usr/local/bin/tsc file which contained the following:

#!/usr/bin/env node
require('../lib/tsc.js')

But my node.js program is named nodejs. So I renamed the interpreter directive above to the following:

#!/usr/bin/env nodejs
require('../lib/tsc.js')

Next, I created a file named hello_world.ts for compiling:

function hello(name: string): void {
console.log(`hello, ${name}!`);
}
hello('world');

Then I entered the following in my terminal emulator’s command line interface (Bash):

tsc hello_world.ts

TypeScript compiled the .ts file into the following .js file named hello_world.js:

function hello(name) {
console.log("hello, " + name + "!");
}
hello('world');

To run the code above, I invoked nodejs below in my terminal emulator’s CLI (Bash):

nodejs hello_world.js

Which returned the following in my CLI:

hello world!