Guided Notes

Modules, tsconfig & Declaration Files

import/export with types, type-only imports, tsconfig.json essentials, declaration files (.d.ts), DefinitelyTyped (@types), and typing JavaScript libraries.

Modules and types

Slide 1 / 4

TypeScript uses standard ES module syntax:

// money.ts export type Currency = "TZS" | "KES" | "USD"; export function format(amount: number, currency: Currency): string { … }

// app.ts import { format, type Currency } from "./money";

import type { X } (or the inline type modifier) imports only types β€” erased completely from the output, which avoids accidental runtime imports and helps bundlers.

← Null, Undefined & Strict Mode