I am trying to use subsets from enum
keys as interface keys. No luck so far, I get the compiler error A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
enum Operator {
eq = 'eq',
neq = 'neq',
lt = 'lt',
lte = 'lte',
gt = 'gt',
gte = 'gte',
in = 'in'
}
interface Filter {
range: {
[Operator.gt | Operator.gte]: string, // <- error
[Operator.lt | Operator.lte]: string // <- error
}
}
Any idea how to solve that?