typestar

Classes & patterns

19 steps in 5 sets of TypeScript.

Where the types meet real code. Classes with parameter properties and access modifiers, discriminated Result types for errors, builders and dependency injection, and typing things that involve time or caching.

Nineteen steps. The Result set is the interesting one: TypeScript makes errors-as-values pleasant enough that a lot of codebases have stopped throwing.

Start this tour

Classes

Results & validation

Building & injecting

Timing & memory

  • Typed memoizeMemoization that keeps the original signature intact.
  • Typed debounceDebounce with the wrapped function's argument types preserved.
  • Typed throttleThrottle with the wrapped function's signature preserved.
  • Typed sleepA typed delay, the building block for everything else async here.
  • Async retryRetries an async operation with backoff, typed on what it resolves to.

Encore

  • schema.tsA tiny schema validator where the parsed type is inferred from the schema.

The other TypeScript tours