Skip to content

Commit

Permalink
🤖 Merge PR #69561 [lodash] Fix _.partial() with 3 arity func and full…
Browse files Browse the repository at this point in the history
… args by @YuseiUeno
  • Loading branch information
YuseiUeno committed May 16, 2024
1 parent ab5017e commit 7fb3bcc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 0 additions & 1 deletion types/lodash/common/function.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,6 @@ declare module "../index" {
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: __, plc2: __, arg3: T3): Function3<T1, T2, T4, R>;
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: __, arg3: T3): Function2<T2, T4, R>;
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: __, arg2: T2, arg3: T3): Function2<T1, T4, R>;
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, arg2: T2, arg3: T3): Function1<T4, R>;
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: __, plc2: __, plc3: __, arg4: T4): Function3<T1, T2, T3, R>;
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: __, plc3: __, arg4: T4): Function2<T2, T3, R>;
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: __, arg2: T2, plc3: __, arg4: T4): Function2<T1, T3, R>;
Expand Down
14 changes: 13 additions & 1 deletion types/lodash/lodash-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7282,6 +7282,9 @@ _.templateSettings; // $ExpectType TemplateSettings
const func3 = (arg1: number, arg2: string, arg3: boolean): number => {
return arg1 * arg2.length + (arg3 ? 1 : 0);
};
const func4 = (arg1: number, arg2: string, arg3: boolean, arg4: number): number => {
return arg1 * arg2.length + (arg3 ? 1 : 0) - arg4;
}

// with arity 0 function
_.partial(func0); // $ExpectType () => number
Expand All @@ -7295,7 +7298,16 @@ _.templateSettings; // $ExpectType TemplateSettings
_.partial(func2, _.partial.placeholder, "foo"); // $ExpectType Function1<number, number>
_.partial(func2, 42, "foo"); // $ExpectType () => number
// with arity 3 function
_.partial(func3, 42, _, true);
_.partial(func3) // $ExpectType (arg1: number, arg2: string, arg3: boolean) => number
_.partial(func3, 42) // $ExpectType (arg2: string, arg3: boolean) => number
_.partial(func3, 42, _, true) // $ExpectType Function1<string, number>;
_.partial(func3, 42, "foo", true) // $ExpectType () => number
// with arity 4 function
_.partial(func4) // $ExpectType (arg1: number, arg2: string, arg3: boolean: arg4: number) => number
_.partial(func4, 42) // $ExpectType (arg2: string, arg3: boolean: arg4: number) => number
_.partial(func4, 42, _, true, 10) // $ExpectType Function1<string, number>;
_.partial(func4, _, _, _, 10) // $ExpectType Function3<number, string, boolean, number>;
_.partial(func4, 42, "foo", true, 10) // $ExpectType () => number

// with arity 0 function
_.partialRight(func0); // $ExpectType Function0<number>
Expand Down

0 comments on commit 7fb3bcc

Please sign in to comment.