Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Combining types broken? #19043

Copy link
Copy link
@garrettm

Description

@garrettm
Issue body actions

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'.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.