Skip to main content

typectx v0.11: Speaking the Same Language

· 3 min read
@someone635

Version 0.11 brings a major, but purely syntactic, shift to typectx. I've decided to move away from the "supply chain" metaphor and embrace standard Dependency Injection terminology.

When I first created typectx, I used terms like supplier and product because they fit the mental model of a functional, decoupled supply chain. But over time, it became clear that this bespoke vocabulary was adding an unnecessary learning curve for developers coming from classical DI frameworks like NestJS or Spring.

In v0.11, the underlying engine remains exactly the same—it's still a hyper-minimalistic, functionally pure context container—but the API now speaks a language everyone already knows.

Let's dive into the renames.

typectx v0.10: Inference Over Annotations

· 4 min read
@someone635

Version 0.10 reverses one of v0.9's main recommendations. In v0.9, I made ProductSupplier easier to write explicitly because I thought manual supplier annotations would be the best way to improve TypeScript performance in large codebases. In practice, that was the wrong optimization target.

The best-performing way to use typectx is now the simplest one: let TypeScript infer your suppliers, and let typectx store the results of recursion internally instead of exposing a recursive public type everywhere. This release also removes $assemblers entirely and replaces that pattern with direct contextual assembly via ctx($supplier).assemble(...).

Let's dive in.

typectx v0.8: A ProductSupplier Type You Can Actually Use

· 4 min read
@someone635

Version 0.8 rewrites typectx's internals so that the ProductSupplier type is finally practical for explicit type annotations. If you've ever wanted to annotate your suppliers to speed up TypeScript's language server in a large codebase, v0.7's generic signatures made that painful. v0.8 fixes the foundation.

Let's dive in.

typectx v0.7: Request Suppliers and Unified Types

· 4 min read
@someone635

Version 0.7 brings a cleaner mental model to typectx by renaming "Resources" to "Request Suppliers" and unifying the Resource and Product types into a single Supply type. These breaking changes make the library's intent clearer and reduce conceptual overhead.

Let's dive in.

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 :).