Skip to content

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.

3 participants