I have problem with defined types and checking if a value is contained in that type.
Here is my example:
these are the types:
export type Key
You could use a string enum.
export enum Keys = {
Features = 'features',
Special = 'special',
}
// Compare it
if (currentKey === Keys.Special) { console.log('Special key is set'); }
In order to check if your value is defined in the predefined Enum at all you can do:
if (currentKey in Keys) { console.log('valid key'); }