Typescript notes


Bundling

  1. Transpile TS files using tsc:
npx tsc path/to/main.ts

(Note the *.ts extension! 👆)

  1. Bundle transpiled JS files:
npx esbuild path/to/main.js --bundle [...]

(Note the *.js extension! 👆)

Importing

Importing works the same way in TS as in modern JS:

// person.ts
export class Person { ... }
// main.ts
import { Person } from "./person"
const p = new Person(...)