0Pricing
TypeScript Academy · Lesson

Building a Decorator Framework

Combine decorators and metadata into a mini framework.

Building a Mini Framework

Now we combine decorators and metadata to build a tiny validation framework. Field decorators record rules into class metadata; a validate function reads them back and checks an instance.

The Plan

We will (1) define field decorators like @minLength and @isEmail that store rules in context.metadata, then (2) write a validate(instance) that walks those rules.

All lessons in this course

  1. Stage 3 Decorators Explained
  2. Decorator Metadata
  3. reflect-metadata and Design Types
  4. Building a Decorator Framework
← Back to TypeScript Academy