0Pricing
TypeScript Academy · Lesson

TypeScript 5.0: Decorators Standard and const Type Params

Use the new decorators proposal and const generic parameters.

TypeScript 5.0 Overview

TypeScript 5.0 brought the standardized TC39 decorators proposal (Stage 3), const type parameters, new verbatim module syntax, and significant performance improvements.

// TS 5.0 release: March 2023
// npm install typescript@5

Stage 3 Decorators

TS 5.0 implements the official TC39 Stage 3 decorators proposal — different from the legacy experimental decorators. No more experimentalDecorators: true needed.

// New standard decorator — no experimentalDecorators flag needed
function logged(target: Function, ctx: ClassDecoratorContext) {
  return class extends (target as any) {
    constructor(...args: any[]) {
      console.log("Creating", target.name);
      super(...args);
    }
  };
}

@logged
class User { constructor(public name: string) {} }

All lessons in this course

  1. TypeScript 5.0: Decorators Standard and const Type Params
  2. TypeScript 5.1-5.2: Improved Inference
  3. TypeScript 5.3-5.4: New Narrowing and NoInfer
  4. TypeScript 5.5+: Isolated Declarations and Beyond
← Back to TypeScript Academy