-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Indexed Access TypesThe issue relates to accessing subtypes via index accessThe issue relates to accessing subtypes via index accessFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
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,
DataTis of type{ b : false }DataT["b"]is of typefalsetrue extends falseshould 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.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Indexed Access TypesThe issue relates to accessing subtypes via index accessThe issue relates to accessing subtypes via index accessFixedA PR has been merged for this issueA PR has been merged for this issue