I have a situation where I am using the following type:
export type AutocompleteChangeReason =
| 'createOption'
| 'selectOption'
| 'removeOption'
| 'clear'
| 'blur';
But when I try to compress the code below, it gives me an error.
(reason: AutocompleteChangeReason) => {
const s: AutocompleteChangeReason = 'selectOption';
if (reason === s) {
}
}
I have considered converting them to strings by using String.
String(a) === String(b)
What is the best practice in this case?
The error message reads:
This comparison appears to be unintentional because the types 'ControlledOptionsType' and 'string' have no overlap.ts(2367)