Skip to content

Add TypeScript definition#16

Merged
sindresorhus merged 1 commit intosindresorhus:masterfrom
BendingBender:typescript-defs
Mar 8, 2019
Merged

Add TypeScript definition#16
sindresorhus merged 1 commit intosindresorhus:masterfrom
BendingBender:typescript-defs

Conversation

@BendingBender
Copy link
Copy Markdown
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...

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.

2 participants