Typescript doesn't infer correct type with Generic extending string union type?
type Test = 'a' | 'b' | 'c';
function foo(arg: T) {
if (arg === 'a') {
console.log(arg);
}
}
like this.. I expect arg inferred 'a' in if block.
but ts infer as just T.
why this situation?
I think that extends keyword has something...