Here my code looks like:
export const EMOJI_NAME_KEY = "n";
export const EMOJI_UNICODE_KEY = "u";
export interface Emoji {
[EMOJI_NAME_KEY]: string[];
[EMOJI_UNICODE_KEY]: string;
}
const emoji: Emoji = {
[EMOJI_NAME_KEY]: 'thumb',
[EMOJI_UNICODE_KEY]: 'some_unicode_key'
}
Now whenever I try to access a value from Emoji type, I'm getting an error. For example:
console.log(emoji[EMOJI_NAME_KEY]) // returns error in the terminal like below
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Emoji'. No index signature with a parameter of type 'string' was found on type 'Emoji'