(typeof x == foo
) fails to typecheck as (typeof x == 'foo')
#21315
Labels
Duplicate
An existing issue was already created
Milestone
TypeScript Version: 2.6
Search Terms:
typeof
Code
Expected behavior:
Program typechecks. (Because changing `function` to 'function' works.)
Actual behavior:
Program does not typecheck.
Playground Link:
https://www.typescriptlang.org/play/#src=function%20test(x%3A%20Function%20%7C%20string)%20%7B%20%0D%0A%20%20%20%20if%20(typeof%20x%20%3D%3D%3D%20%60function%60)%20%7B%20%0D%0A%20%20%20%20%20%20%20%20x()%3B%0D%0A%20%20%20%20%7D%0D%0A%7D
Related Issues:
The text was updated successfully, but these errors were encountered: