Troubleshooting TypeScript Function with Schema Type Constraints
hello there!
I'm trying to create a function that takes a generic schema in parameter and the passed schema should have a Type of a given shape:
I can call this func with
But if the given schema has a branded string for the Id, then it does not compile:
The last line of the ts error is the following:
I was expecting that it would work since a string branded type extends string..
I'm trying to create a function that takes a generic schema in parameter and the passed schema should have a Type of a given shape:
I can call this func with
S.struct({ id: S.string }) without problem, as expected:But if the given schema has a branded string for the Id, then it does not compile:
The last line of the ts error is the following:
I was expecting that it would work since a string branded type extends string..
