-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
TypeScript Version: 2.6.2 | 2.7.0-dev.20180112
Code
// test.ts
function foo(map: Map<string, string>) {
let bar = map.get('key');
if (!bar) {
return;
}
let res1 = bar.repeat(3);
let fun = () => {
let res2 = bar.repeat(3);
}
}Expected behavior:
no errors
Actual behavior:
test.ts(11,20): error TS2532: Object is possibly 'undefined'.
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug