-
-
Notifications
You must be signed in to change notification settings - Fork 571
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
Proposal: ArrayTail
#135
Comments
What's the real-world use-case? |
for example some of latest release of got brokes many of our types, changed type of import { BeforeRedirectHook as GotBeforeRedirectHook, NormalizedOptions } from 'got';
type PatchedNormalizedOptions = Omit<NormalizedOptions, 'context'> & {
context?: YourType;
};
type BeforeRedirectHook = (options: PatchedNormalizedOptions, ...args: Tail<Parameters<GotBeforeRedirectHook>>) => ReturnType<GotBeforeRedirectHook>; here I overrite first argument and use Tail to add original arguments to the end |
type Tail<T extends any[]> = T extends [any, ...infer P] ? P : [] I like this. |
I've used tail to create a function signature without the first argument for curried functions. |
This is accepted. I think We actually already use this internally: type-fest/source/internal.d.ts Lines 109 to 112 in 7950542
|
Upvote & Fund
The text was updated successfully, but these errors were encountered: