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

Loosen up BatchLoadFn TS definition, Promise -> PromiseLike #146

Merged
merged 1 commit into from Nov 13, 2019

Conversation

tgriesser
Copy link
Contributor

Given than DataLoader only checks that a batch loader is "thenable", changing the TS def from Promise<Array<V | Error>> to PromiseLike<Array<V | Error>> better matches the intent - any object which matches the promise .then signature.

This is useful when returning promises from Bluebird, which utilizes the PromiseLike interface but doesn't conform to the Symbol.toStringTag TypeScript uses to check for the Promise type.

Otherwise I find myself wrapping the Bluebird promises in an extra Promise.resolve just to type-check.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 93a94a1 on tgriesser:ts-PromiseLike into 420e62f on facebook:master.

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

Successfully merging this pull request may close these issues.

None yet

3 participants