setup
npm install --save-dev tsconfig typescript
npx tsc --init
compile
npx tsc file.ts
commonjs vs ECMAScript modules
By default (with esModuleInterop false or not set) TypeScript treats CommonJS/AMD/UMD modules similar to ES6 modules. This turned out to be a mistake, but still exists by default in typescript to avoid a breaking change.
For new and existing projects you should set esModuleInterop to true. This is
set automatically with npx tsc --init.