Pass generic type argument through the literal object with different field names per each field if number of fields values is limited by 4
问题 What am I doing? I want to make mapping of an object field-by-field to objects of some generic type. I have 4 runtime cases (with runtime check and throwing exception if not matches) that I've used as a properties of original object: false transforms to Smth<unknown> | undefined true transforms to Smth<unknown> [] transforms to Smth<unknown> with 0 or more elements [true] transforms to Smth<unknown> with 1 or more elements Actually that's not very difficult, but I'm not very happy to have