I have the following Typescript type:
type Config = {
key: string,
type: `input` | `switch` | `radios` | `select` | `checklist` | `image`,
options: string[],
value?: any,
}
I would like to be a bit more refined with my any type I set on the value property:
For example, I know that if the type is set to input, then value will be a string.
If the type is set to switch, the value will be boolean
In a more complicated case, if type is radios, I know that value will be one of the values from the options array of strings.
Is there a way I can capture all of this?