I can do this:
export function changeParameter(parameter: Parameters.booleanParameter, value: boolean): ChangeParameterAction
export function changeParameter(parameter: Parameters.stringParameter, value: boolean): ChangeParameterAction
// ... more types
export function changeParameter(parameter: Parameters, value: any): ChangeParameterAction {
return { type: PARAMETER_CHANGED, parameter, value };
};
But I can't seem to figure out how to do the following without getting any errors (including changing the declarations to similar arrow functions but I so don't know how to do that right that I'm not pasting any examples.
const changeParameter = (parameter: Parameters, value: any): ChangeParameterAction => ({ type: PARAMETER_CHANGED, parameter, value })
Is there a way to do this? (Also is there any shorter way to construct this overload without listing all the combinations separately?)