Skip to content

Can't bind the apply function #5681

@marcusdarmstrong

Description

@marcusdarmstrong

Hi there! I've been trying to get rid of a $FlowFixMe in our codebase and have isolated it down to this:

https://flow.org/try/#0PTAEAEDMBsHsHcBQiCmAPADrATgF1ACYqQCGArtPgBSQBcoAYmQHYDGuAlrMwJSgC8APlCQAdCQwZoAT1EAjDswI0eAbkRA

That is,

// @flow

export default (f: Function) => f.apply.bind(f);

yields

3: export default (f: Function) => f.apply.bind(f);
                                   ^ call of method `bind`. Callable signature not found in
3: export default (f: Function) => f.apply.bind(f);
                                   ^ function type

Even though...

const foo = () => console.log('Works');
const bar = f => f.apply.bind(f);
bar(foo)(); // Works

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions