Effect CommunityEC
Effect Community3y ago
19 replies
jasonkuhrt

Inferred Generics from runtime schema definitions

I often have data types with generics, for example:

interface Event<Name extends string = string> {
  name: Name
}


The ability to have data types with stronger static guarantees in certain code paths is very helpful I've found, in large projects in particular.

I have in the past used Zod, and one of its major issues is its inability to define schemas that have inferred generics.

Now, as far as I understand, inferred generics is something TS itself is not supporting

Has the Effect community come up with clever solutions to this issue? I'm thinking for example TS+ perhaps.

Or just effect patterns, that work around the issue, with minimal effort, at least.
Was this page helpful?