Can we shorten this statement using string enum to restrict keys:
Array<{ [enum.example1]: Example } | { [enum.example2]: Example } | ...>
// or equivalent
({ [enum.example1]: Example } | { [enum.example2]: Example } | ...)[];
We can make it more concise like { [key: string]: Example }
, but with key restriction from a string enum:
For instance, these variations do not seem to work:
{ [enum]: Example }[];
// or
{ [key: enum]: Example }[];