Challenges with Defining Type Guard for Allowed Schemas
Hi all! I'm trying to build an abstraction on top of
To mean: "valid field schemas are any schema that can encode to string" (and don't need any context)
But because of how the variance for
The variance setup makes sense to prevent incompatible schemas being used interchangably, but it makes it hard (impossible?) to "talk about" types of schemas before they are used.
Any advice? Thanks a lot!
@effect/schema and I'm running into the issue that I want to define a type guard to constrain allowed schemas:To mean: "valid field schemas are any schema that can encode to string" (and don't need any context)
But because of how the variance for
I and A is set up (invariant), actual schemas that conform to the intended contract are incompatible on assignment.The variance setup makes sense to prevent incompatible schemas being used interchangably, but it makes it hard (impossible?) to "talk about" types of schemas before they are used.
Any advice? Thanks a lot!
