mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Merge pull request #21127 from andnp/LodashPick
lodash use typescript Pick<> to improve _.pick typings
This commit is contained in:
Vendored
+7
-2
@@ -13908,10 +13908,15 @@ declare namespace _ {
|
||||
* _.pick(object, ['a', 'c']);
|
||||
* // => { 'a': 1, 'c': 3 }
|
||||
*/
|
||||
pick<T extends object>(
|
||||
pick<T extends object, U extends keyof T>(
|
||||
object: T | null | undefined,
|
||||
...props: Array<Many<U>>
|
||||
): Pick<T, U>;
|
||||
|
||||
pick<T>(
|
||||
object: T | null | undefined,
|
||||
...props: PropertyPath[]
|
||||
): PartialObject<T>;
|
||||
): PartialDeep<T>;
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapper<TValue> {
|
||||
|
||||
@@ -11187,6 +11187,12 @@ namespace TestPick {
|
||||
result = _.pick(obj, ['b', 1], 0, 'a');
|
||||
}
|
||||
|
||||
{
|
||||
let result: Pick<TResult, 'a' | 'b'>;
|
||||
result = _.pick(obj, 'a', 'b');
|
||||
result = _.pick(obj, ['a', 'b']);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitWrapper<Partial<TResult>>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user