My interfaces.ts looks as follows:
export const types = ["foo", "bar"] as const;
export type CustomType = typeof types[number];
And I want to check whether a string is a CustomType. When I use includes it gives me an error telling me:
Argument of type 'string' is not assignable to parameter of type '"foo" | "bar"'.
I could use findIndex but is there no other way so I can use includes?
const a = types.includes(value); // error
const b = types.findIndex(type => type === value) < 0 // boolean