Skip to content
New issue

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

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

Already on GitHub? # to your account

Add TypeScript definition #16

Merged
merged 1 commit into from
Mar 8, 2019
Merged

Add TypeScript definition #16

merged 1 commit into from
Mar 8, 2019

Conversation

BendingBender
Copy link
Contributor

@BendingBender BendingBender commented Mar 6, 2019

I'm not really happy with the definition. I don't like that many overloads just to support functions with different arity for the fn method.

It would be much easier if onCancel would be passed in as first parameter instead of last:

static fn<ArgumentsType extends unknown[], ReturnType>(
	userFn: (onCancel: OnCancelFunction, ...arguments: ArgumentsType) => PromiseLike<ReturnType>
): (...arguments: ArgumentsType) => PCancelable<ReturnType>;

But I suppose it's not very ergonomic and would break all users' code...

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

Successfully merging this pull request may close these issues.

2 participants