Skip to content

Feature Request: Infer the other way. #1159

@ivands

Description

@ivands

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions