Jonatan Matajonmatum.com
conceptsnotesexperimentsessays
© 2026 Jonatan Mata. All rights reserved.v2.1.1
Concepts

TypeScript

Typed superset of JavaScript adding optional static types, improving developer productivity, error detection, and code maintainability.

seed#typescript#javascript#types#static-analysis#tooling#dx

What it is

TypeScript is a superset of JavaScript that adds optional static types. All valid JavaScript is valid TypeScript, but TypeScript allows declaring types that the compiler verifies before execution, catching errors in development instead of production.

Why TypeScript?

  • Errors detected at compile time, not runtime
  • Intelligent IDE autocomplete
  • Safe refactoring at scale
  • Implicit documentation in types
  • De facto standard for serious JavaScript projects

Key features

  • Interfaces and types: define data shapes
  • Generics: reusable parameterized types
  • Union types: string | number
  • Type inference: compiler deduces types automatically
  • Strict mode: maximum type safety

TypeScript in the ecosystem

  • React: typed JSX, typed props
  • Next.js: native support
  • AWS CDK: typed infrastructure
  • Node.js: typed backend

Configuring strict

Strict mode enables all type checks. It is the recommended configuration for new projects:

{
  "compilerOptions": {
    "strict": true,
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "esModuleInterop": true,
    "skipLibCheck": true,
    "outDir": "dist"
  }
}

Individual flags that strict enables:

FlagWhat it prevents
strictNullChecksAccessing null/undefined without checking
noImplicitAnyVariables without explicit or inferred type
strictFunctionTypesIncorrect contravariant function parameters
strictPropertyInitializationUninitialized class properties
noImplicitThisUsing this without a known type

When NOT to use TypeScript

  • One-off scripts (bash or Python are faster)
  • Throwaway prototypes where iteration speed matters more than correctness
  • Projects where the team has no experience with static types (the learning curve is real)

Why it matters

TypeScript turns runtime errors into compile-time errors. In projects of any size, the type system acts as living documentation, enables safe refactoring, and reduces the most common category of bugs: type errors.

References

  • TypeScript Documentation — Official documentation.
  • TypeScript Handbook — Complete guide.
  • TypeScript Playground — Microsoft, 2024. Interactive environment for experimenting with TypeScript.

Related content

  • React

    JavaScript library for building user interfaces through declarative, reusable components, with an ecosystem spanning from SPAs to full-stack applications with Server Components.

  • Spec-Driven Development

    Development methodology where the specification is written before the code, serving as a contract between teams and as the source of truth for implementation.

  • Linting & Formatting

    Automated tools that verify style, detect potential errors, and format code consistently, eliminating style debates and improving quality.

  • AWS CDK

    AWS infrastructure as code framework that allows defining cloud resources using programming languages like TypeScript, Python, or Java, generating CloudFormation.

Concepts