Typescript doesn't infer correct type with Generic extending string union type?
type Test = 'a' | 'b' | 'c'; function foo<T extends Test>(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...
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.