Skip to main content

typectx v0.6: Simpler API, Deeper Trees

· 6 min read
@someone635

The v0.5 and v0.6 releases bring two major improvements to typectx: a 20x increase in dependency tree depth through tail-recursive type optimizations, and a cleaner, more intuitive API that replaces the cryptic $() and $$() accessors with deps and ctx().

Let's dive in.

typectx v0.4 and new @typectx/react adapter are out!

· 6 min read
@someone635

Version 0.4 of typectx has two potentially breaking changes: the reassemble() and $$($$supplier).assemble() APIs have been merged, removing the need for the reassemble() function altogether. Also, the @typectx/react adapter package have been introduced to address a critical performance issue that was overlooked in previous typectx version in React client components: referential integrity of dynamically generated components.

Let's dive into what changed and why it matters.

DI containers are dead, long live context containers!

· 12 min read
@someone635

Equation banner

info

This story is for you if:

  • You're still sad React Context cannot be used in Server Components.
  • You like the ideas of SOLID architecture and decoupling in your apps but have found current DI frameworks in TypeScript unsatisfying or too complex.
  • You've ever wanted to see a naked, frameworkless DI container in its simplest form (NSFW warning :P).
  • You love TypeScript and enjoy pushing its inference capabilities to their limits.

This is the story of how, while refactoring my React app from Client to Server Components, I was forced to spend a year of my free time to:

  1. rediscover DI containers,
  2. obsolete traditional DI frameworks,
  3. discover Context containers, and
  4. finally, build my own fully type-inferred context container framework, typectx.

A tale of dumb, costly refactoring decisions that I hope produced a useful result in the end :).