Trying to define a class property for another type:
class TypeOne {
public static readonly code: string = 'code';
}
class TypeTwo { public [TypeOne.code]: TypeOne }
Encountering an error message:
The computed property name in the class property declaration must have a simple literal type or a unique symbol
Successfully using constants from an enum:
enum TypeThree {
key = 'key'
}
class TypeFour { public [TypeThree.key]: TypeThree }
Any suggestions on setting a constant value as an immutable key for the compiler to recognize the field name?