You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
k's literal type isn't "fresh" since it came from a type position instead of an expression, so isn't widened. (While since l is typeof u it's still fresh)
Activity
NN--- commentedon May 4, 2019
Related: #30680
It is due to widening.
If you want to narrow type you have to specify explicitly as you did or use some tricks.
jcalz commentedon May 5, 2019
effort level matching answer: don’t see a bug here, try SO
weswigham commentedon May 8, 2019
I'd refer to #241 for explaining away a return type being wider than expected
cevek commentedon May 9, 2019
Something strange happens here
weswigham commentedon May 9, 2019
k's literal type isn't "fresh" since it came from a type position instead of an expression, so isn't widened. (While sincelistypeof uit's still fresh)typescript-bot commentedon May 11, 2019
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.