Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't bind the apply function #5681

Closed
marcusdarmstrong opened this issue Jan 18, 2018 · 3 comments · May be fixed by #7879
Closed

Can't bind the apply function #5681

marcusdarmstrong opened this issue Jan 18, 2018 · 3 comments · May be fixed by #7879

Comments

@marcusdarmstrong
Copy link

marcusdarmstrong commented Jan 18, 2018

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
@oriSomething
Copy link

From curiosity, why binding apply?

@marcusdarmstrong
Copy link
Author

Not my code so I can't be 100% sure, but I think it might have just been so that we could use an args array.

@SamChou19815
Copy link
Contributor

This now works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants