This is not about indexing a const enum when the option preserveConstEnums is true. I read the issue that it is impossible.
What I did is to use the copy of the enum.
const enum Kind {
A, B, C
};
const KindName: {[key in Kind]: string} = {
[Kind.A]: "A",
[Kind.B]: "B",
[Kind.C]: "C",
};
console.log(KindName[Kind.A]);
But I can just assign the KindName property to any string. How to force the string value to be the same as corresponding enum property?
Thanks.