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