Closed
Description
TypeScript Version: 3.2.0-dev.20181117
EDIT: I just tested with TS 3.2.0-rc and it has this bug
Search Terms: true extends false
Code
I feel like I'm losing my mind here. Or maybe I'm tired because it's 3.34am. Maybe I need to take a break. Am I missing something obvious?
//OK
//Expected: "n"
//Actual: "n"
type no = true extends false ? "y" : "n";
type G<DataT extends { b : boolean }> = (
true extends DataT["b"]?
["Actual", "true extends", DataT["b"]] :
"Expected"
)
//Wat?
//Expected: "Expected"
//Actual: ["Actual", "true extends", false]
type g = G<{ b : false }>;
Expected behavior:
g
to be of type "Expected"
.
Intuitively,
DataT
is of type{ b : false }
DataT["b"]
is of typefalse
true extends false
should be...false
Actual behavior:
g
is of type ["Actual", "true extends", false]
Playground Link: Here
EDIT: I just tested and this is not a problem in TS 3.0.1
I'm not crazy, phew.