Open zbinlin opened 5 years ago
I'm getting the same thing but in an even more basic example on the playground.
type Literal = 'test';
interface SomeObject {
[Literal]: boolean;
}
let sym = Symbol('test');
interface AnotherObject {
[sym]: boolean;
}
A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
'Literal' only refers to a type, but is being used as a value here.
A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
TypeScript Version: 3.5.1
Code
Expected behavior: No error
Actual behavior: Error: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
Playground Link: https://www.typescriptlang.org/play/index.html#code/MYewdgzgLgBApmArgWxgFQJ4Ac4RgbwFgAoGMmAMQHkqYBeGABgBoSBfAbhJNElgDkAhslz0CJcjADamHBAB01KgF0AXDADkAMxAgNrYmxiC8vaF2IkAlmChwATlsHA4MAEKCAXuNLkpQkQgZbFxFGmU1GGh7GwBzCzYgA