Closed
Description
TypeScript Version: 3.7.x-dev.20200220
Search Terms: Implicit type coersion function ternary
Code
function isSomething(): boolean {
return false
}
const haha = isSomething ? 'a' : 'b';
Expected behavior: Typescript should throw error in = isSomething ?
instead of coercing isSomething
to boolean
Actual behavior: Typescript coerced isSomething
(function) to boolean
Playground Link: link
Related Issues:
Metadata
Metadata
Assignees
Labels
No labels