Closed
Description
TypeScript Version: 4.0, nightly
Search Terms:
Generic, refinement, refine, extends boolean
Code
function foo<TValue extends boolean>(value: TValue) {
if (value === true) {
const truthy: true = value
}
}
Expected behavior:
TValue
should be refined to true
. At the very least, the value
variable should.
Actual behavior:
Error:
Type 'TValue' is not assignable to type 'true'.
Type 'boolean' is not assignable to type 'true'.(2322)