<!-- 🚨 STOP 🚨 STOP 🚨 STOP 🚨 Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common "Bugs" That Aren't Bugs section! Please help us by doing the following steps before logging an issue: * Search: https://github.com/Microsoft/TypeScript/search?type=Issues * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ Please fill in the *entire* template below. --> <!-- Please try to reproduce the issue with the latest published version. It may have already been fixed. For npm: `typescript@next` This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly --> **TypeScript Version:** 4.0, nightly <!-- Search terms you tried before logging this (so others can find this issue more easily) --> **Search Terms:** Generic, refinement, refine, extends boolean **Code** ```ts 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) ``` **Playground Link:** <!-- A link to a TypeScript Playground "Share" link which demonstrates this behavior --> https://www.typescriptlang.org/play?ts=4.1.0-dev.20201030#code/GYVwdgxgLglg9mABMOcA8AVAagQwDYgCmihAHlIWACYDOiARqnoTmAHwAUAbvkQFyJsvQgEpEAbwCwAKESIYwRN2GIAvOsRQATkTFTZcxBAQ0omnVAAWATwHaiaxDwKEZcgL4zP0oA
TypeScript Version: 4.0, nightly
Search Terms:
Generic, refinement, refine, extends boolean
Code
Expected behavior:
TValueshould be refined totrue. At the very least, thevaluevariable should.Actual behavior:
Error:
Playground Link:
https://www.typescriptlang.org/play?ts=4.1.0-dev.20201030#code/GYVwdgxgLglg9mABMOcA8AVAagQwDYgCmihAHlIWACYDOiARqnoTmAHwAUAbvkQFyJsvQgEpEAbwCwAKESIYwRN2GIAvOsRQATkTFTZcxBAQ0omnVAAWATwHaiaxDwKEZcgL4zP0oA