Merge pull request #21127 from andnp/LodashPick

lodash use typescript Pick<> to improve _.pick typings
This commit is contained in:
Daniel Rosenwasser
2017-11-05 21:12:34 -08:00
committed by GitHub
2 changed files with 13 additions and 2 deletions
+7 -2
View File
@@ -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> {
+6
View File
@@ -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>>;