run node ts code example Example 1: how to run typescript file npx ts-node src/foo.ts Example 2: npm typescript npm install -g typescript