Closed
Description
TypeScript Version: 2.2.0-dev.20161202
Code
function getGetter() {
let data = {}
data['bar'] = 1
if (hasBar(data)) {
return () => data.bar // Property 'bar' does not exist on type '{}'.
}
}
function hasBar(thing): thing is {bar: number} {
return typeof thing.bar == 'number'
}
Expected behavior:
Compile successfully.
Actual behavior:
index.ts(6,21): error TS2339: Property 'bar' does not exist on type '{}'.