I had high hopes for achieving this, but unfortunately it's a no-go:
type MyType<
T extends {},
K extends string = 'keyName'
> = T & {
[K]: {
value: string
}
};
The error states that a computed property name in a type literal must refer to an expression with either a literal type or a unique symbol.ts
Is there a way to input a key and shape the resulting type
or interface
?
Thank you.