โ† TypeScript learning path
TypeScript ยท Module 9 of 10

Modules and configuration

Organise code with modules and tune tsconfig.json.

๐Ÿ“– Key ideas

  1. export / import share types and values between files.
  2. import type { User } imports types only.
  3. tsconfig: target, module, strict, outDir, paths.
  4. Declaration files (.d.ts) describe JavaScript libraries.
  5. @types/ packages add types for JS libraries: npm i -D @types/node.
๐Ÿ’ก Real-life example: A .d.ts file is a user manual for a machine you didn't build: it tells TypeScript how to use it.
.d.tsType declaration file
@typesCommunity type packages
import typeImports only types
outDirFolder for compiled JS