@naverpay/hidash
Version:
improved lodash
21 lines (18 loc) • 1.63 kB
text/typescript
import { List } from './types.mjs';
type PropertyName = string | number | symbol;
type PartialShallow<T> = {
[P in keyof T]?: T[P] extends object ? object : T[P];
};
type IterateeShorthand<T> = [PropertyName, unknown] | PartialShallow<T> | undefined | null;
type ListIterator<T, TResult> = (value: T, index: number, collection: ArrayLike<T>) => TResult;
type ListIteratee<T> = ListIterator<T, unknown> | IterateeShorthand<T>;
type ListIterateeCustom<T, TResult> = ListIterator<T, TResult> | IterateeShorthand<T>;
type ListIteratorTypeGuard<T, S extends T> = (value: T, index: number, collection: List<T>) => value is S;
type ValueIteratee<T> = ((value: T) => unknown) | IterateeShorthand<T>;
type ValueKeyIteratee<T> = ((value: T, key: string) => unknown) | IterateeShorthand<T>;
type ValueKeyIterateeTypeGuard<T, S extends T> = (value: T, key: string) => value is S;
type ObjectIterator<T, TResult> = (value: T[keyof T], key: string, collection: T) => TResult;
type ObjectIteratee<TObject> = ObjectIterator<TObject, unknown> | IterateeShorthand<TObject[keyof TObject]>;
type ObjectIterateeCustom<TObject, TResult> = ObjectIterator<TObject, TResult> | IterateeShorthand<TObject[keyof TObject]>;
type ObjectIteratorTypeGuard<TObject, S extends TObject[keyof TObject]> = (value: TObject[keyof TObject], key: string, collection: TObject) => value is S;
export type { IterateeShorthand, ListIteratee, ListIterateeCustom, ListIterator, ListIteratorTypeGuard, ObjectIteratee, ObjectIterateeCustom, ObjectIterator, ObjectIteratorTypeGuard, PartialShallow, PropertyName, ValueIteratee, ValueKeyIteratee, ValueKeyIterateeTypeGuard };