Skip to content

update type for wrap#146

Open
olehcambel wants to merge 2 commits intoSGrondin:masterfrom
olehcambel:master
Open

update type for wrap#146
olehcambel wants to merge 2 commits intoSGrondin:masterfrom
olehcambel:master

Conversation

@olehcambel
Copy link
Copy Markdown

I changed types for method wrap and it seems to work in the same way and without overloading. If you like it, I can write for the rest of methods.
However, I don't know how to handle T extends any[] - to exclude any

Comment thread bottleneck.d.ts Outdated
wrap<R, A1, A2, A3, A4, A5, A6, A7, A8, A9>(fn: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, arg6: A6, arg7: A7, arg8: A8, arg9: A9) => PromiseLike<R>): ((arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, arg6: A6, arg7: A7, arg8: A8, arg9: A9) => Promise<R>) & { withOptions: (options: Bottleneck.JobOptions, arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, arg6: A6, arg7: A7, arg8: A8, arg9: A9) => Promise<R>; };
wrap<R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>(fn: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, arg6: A6, arg7: A7, arg8: A8, arg9: A9, arg10: A10) => PromiseLike<R>): ((arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, arg6: A6, arg7: A7, arg8: A8, arg9: A9, arg10: A10) => Promise<R>) & { withOptions: (options: Bottleneck.JobOptions, arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, arg6: A6, arg7: A7, arg8: A8, arg9: A9, arg10: A10) => Promise<R>; };
wrap<R, T extends any[]>(
fn: (...args: T) => Promise<R>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not using PromiseLike here https://stackoverflow.com/a/43712949/7876577

@xcao65
Copy link
Copy Markdown

xcao65 commented Mar 20, 2020

I guess T extends any[] is fine.

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