I want to implement a type (handlerResult) that matches any element of a static array (responseDefs) representing the variants of a discriminated unions, but "processed" with a generic type (response):
The naive way I've tried does not produce a discriminated union, but instead merges values of the source object's properties like a construction like response< typeof responseDefs[number] > would do.