Skip to main content

TypeScript

What is TypeScriptโ€‹

TypeScript is a typed superset of JavaScript that compiles to plain JS. Developed by Microsoft, it is Apache-2.0 licensed and currently at version 5.x. With ~123.7M weekly npm downloads, it has become the default choice for any serious JavaScript project.

Why we recommend itโ€‹

  • Type safety โ€” catches entire categories of bugs at compile time instead of at runtime in production.
  • IDE support โ€” autocompletion, inline docs, and refactoring tools work dramatically better with types.
  • Scales with teams โ€” explicit interfaces and types serve as living documentation. New contributors understand a codebase faster.
  • Gradual adoption โ€” you can introduce TypeScript incrementally into an existing JavaScript project. Start strict where it matters, relax where it doesn't.
  • Industry standard โ€” most modern frameworks (React, Next.js, Angular, Nest.js) are written in TypeScript and provide first-class type definitions.
tip

You don't have to convert everything at once. Rename .js files to .ts one at a time and let the compiler guide you. Gradual adoption is a first-class workflow in TypeScript.

When to useโ€‹

  • All new Aliz frontend and Node.js projects โ€” this is the default. If you're starting fresh, use TypeScript.
  • Shared libraries and packages โ€” types make your API surface explicit and prevent misuse.

When NOT to useโ€‹

  • Quick throwaway scripts where the overhead of type annotations outweighs the benefit (e.g., a one-off data migration script).
  • Avoid complex type gymnastics โ€” if a type definition is harder to read than the code it protects, simplify it. Types should help, not hinder.

Resourcesโ€‹