Closed
Description
TypeScript Version: 2.5.3+
TSC works as expected in 2.5.2, unexpected behavior seen in 2.5.3 and @next (typescript@2.6.0-dev.20171007
)
Code
type B = {b: string}
const flowtypes = <A>(b: B) => {
type Combined = A & B
const combined = (fn: (combined: Combined) => void) => null
const literal = (fn: (aPlusB: A & B) => void) => null
return {combined, literal}
}
const {combined, literal} = flowtypes<{a: string}>({b: 'b-value'})
literal(aPlusB => {
aPlusB.b
aPlusB.a
})
combined(comb => {
comb.b
comb.a
})
Expected behavior:
Both literal
and combined
should produce the same behavior, and properties a
and b
should be accessible on the argument for both.
Actual behavior:
comb.a
is unaccessible:
test.ts(21,8): error TS2339: Property 'a' does not exist on type 'Combined'.