I have defined the following TypeScript declarations:
type TDisplayKey = "a" | "b" | "c";
const DISPLAY_KEYS: Record<string, TDisplayKey> = {
A: "a",
B: "b",
C: "c"
};
const DISPLAY_KEY_TITLES: Record<TDisplayKey, string> = {
[DISPLAY_KEYS.A]: "Ay",
[DISPLAY_KEYS.B]: "Bi",
[DISPLAY_KEYS.C]: "Ci"
};
An error is appearing on DISPLAY_KEY_TITLES
in my VSCode editor:
Type '{ [x: string]: string; }' is missing the following properties from type 'Record<TDisplayKey, string>': a, b, c
Even though I have clearly defined all three properties. What could be causing this issue?