{
  "schema_version": "1.0",
  "codex": "thecodex.expert/coding",
  "type": "language-reference",
  "slug": "languages/typescript",
  "name": "TypeScript",
  "section": "Languages",
  "canonical_definition": "TypeScript is a statically typed superset of JavaScript, developed by Microsoft, that adds optional type annotations, interfaces, generics, and advanced type system features to JavaScript \u2014 compiling to plain JavaScript with all types erased, providing compile-time type safety without any runtime overhead.",
  "confidence": "high",
  "last_verified": "2026-06-01",
  "url": "https://thecodex.expert/coding/languages/typescript/",
  "current_version": "TypeScript 5.x (2024)",
  "created": "2012",
  "creator": "Anders Hejlsberg (Microsoft)",
  "typing": "static, structural (not nominal)",
  "execution": "compiles to JavaScript; no TypeScript runtime",
  "relation_to_javascript": "strict superset \u2014 all valid JavaScript is valid TypeScript",
  "paradigms": [
    "object-oriented",
    "functional",
    "procedural"
  ],
  "type_system_features": [
    "interfaces and type aliases",
    "generics with constraints",
    "union types and intersection types",
    "discriminated unions",
    "mapped types",
    "conditional types",
    "template literal types",
    "type narrowing",
    "structural typing"
  ],
  "critical_notes": {
    "types_erased": "All TypeScript types are erased at compile time \u2014 they do not exist in emitted JavaScript",
    "strict_off_by_default": "strict mode is NOT enabled by default \u2014 always set strict:true in tsconfig.json",
    "structural_typing": "TypeScript uses structural typing: compatible shape = compatible type, regardless of declared name",
    "superset": "Valid JavaScript is valid TypeScript \u2014 rename .js to .ts and it compiles",
    "turing_complete_types": "The type system is Turing-complete \u2014 can express arbitrary type computations via conditional types"
  },
  "compilation_tools": {
    "tsc": "Official TypeScript compiler \u2014 full type checking + emit; slowest",
    "esbuild": "Go-based; strips types without checking; ~100x faster; used in Vite",
    "swc": "Rust-based; strips types without checking; used in Next.js 12+",
    "babel": "@babel/preset-typescript strips types without checking"
  },
  "sources": [
    {
      "num": 1,
      "citation": "Microsoft. TypeScript Handbook. typescriptlang.org/docs/handbook/.",
      "tier": 1
    },
    {
      "num": 2,
      "citation": "Microsoft. TypeScript Language Specification. github.com/microsoft/TypeScript/tree/main/doc.",
      "tier": 1
    },
    {
      "num": 3,
      "citation": "Hejlsberg, A. et al. TypeScript 1.0 announcement. Microsoft Build 2014.",
      "tier": 1
    },
    {
      "num": 4,
      "citation": "Ecma International. ECMAScript 2024 Specification. tc39.es/ecma262/.",
      "tier": 1
    },
    {
      "num": 5,
      "citation": "TypeScript GitHub repository. github.com/microsoft/TypeScript.",
      "tier": 1
    }
  ]
}