Closed
Description
TypeScript Version: 3.7.2
Search Terms:
Code
if (true == 1) console.log('This will always execute because of type coercion, TypeScript error is wrong.');
if (true === 1) console.log('This will never execute because error is correct.');
Expected behavior:
if(true == 1)
should not produce an error as it is true
in JS.
Actual behavior:
if(true == 1)
produce this error This condition will always return 'false' since the types 'boolean' and 'number' have no overlap.(2367)
Playground Link:
Playground
Related Issues:
#35567