Seeking for an advice from TS gurus.
Here is base code
export const LETTERS = {
// internal
a: 'a',
// external
b: 'b',
c: 'c',
} as const;
export const internalLetters = [
LETTERS.a,
] as const;
export type LETTER_TYPE = typeof LETTERS[keyof typeof LETTERS];
Now assume I want to have a helper function which accept any letter and defines if it is internal
const isInternal = (letter: LETTER_TYPE) => internalLetters.includes(letter);
And now the error appears:
Can you explain what is wrong with such code and how to achieve my goal?
Also I’m not sure if title for the question is clear itself.