The Infer function is great because it allows us to get the output types of a given struct.
However, it would also be great to be able to get the input types of a given struct.
I'll give an example of the difference:
The following struct will always output a number.
const MyNumber = coerce(number(), string(), (value) => parseFloat(value))
type OutputType = number // generated by Infer
However, it can accept numbers & strings.
So the input type would be:
type InputType = string | number
I need a way to Infer the input type of a struct.
Also, I think this would be a great addition to the already great lib.
The Infer function is great because it allows us to get the output types of a given struct.
However, it would also be great to be able to get the input types of a given struct.
I'll give an example of the difference:
The following struct will always output a number.
However, it can accept numbers & strings.
So the input type would be:
I need a way to
Inferthe input type of a struct.Also, I think this would be a great addition to the already great lib.