Skip to content

Intersected function type returns only first constituent's return type #10508

Description

@vsiao

TypeScript Version: 1.8/Playground

Code

interface A {
    a: boolean;
}
interface B {
    b: boolean;
}

declare const fooAB: (() => A) & (() => B);
const ab = fooAB(); // A

Expected behavior: ab has type A & B

Actual behavior: ab has type A

Perhaps this is being treated as an overloaded call signature, and () => A just happens to be first. If this is by design, it would be great to learn about any known workarounds.

cc kevinder

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions