-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
TypeScript Version: 2.1.1
Code
const x = new Map<string, string>();
x.set("key", "value");
if (x.has("key")) {
const y : string = x.get("key"); // error: y is string | undefined, not string
}
Expected behavior:
y is narrowed down to string
Actual behavior:
y is still string | undefined even after checking if the map has that key
IlanFrumer, ivstas, eugirdor, emilekberg, dsifford and 174 morecshaa, danez, weilin-shi, G-Rath, Flackus and 17 moreicecream17, clemdee, nik-webdevelop and cloudrac3r
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript