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