Closed
Description
TypeScript Version: 2.6.0-dev.201xxxxx
Code
type FormattedDataProvider<T, R = {}> = {
src: R,
format: (item: R) => T
}
let a: FormattedDataProvider<string> = {
src: { a: 23 },
format: v => String(v.a)
}
Expected behavior:
This should compile and infer that v is of type {a: number}
.
Actual behavior:
v is inferred to the default type {}, which results in an error:
error TS2339: Property 'a' does not exist on type '{}'.