export type RelationOneToOne = { [x in E['id']]: T; }; export type RelationOneToMany = { [x in E1['id']]: Array; }; export type RelationOneToManyUnique = { [x in E1['id']]: Set; }; export type IDMappedObjects = RelationOneToOne; export type IDMappedCollection = { data: IDMappedObjects; order: Array; errors?: RelationOneToOne; warnings?: RelationOneToOne; }; export type DeepPartial = { [K in keyof T]?: (T[K] extends Set ? T[K] : T[K] extends Map ? T[K] : T[K] extends object ? DeepPartial : T[K] extends object | undefined ? DeepPartial : T[K]); }; export type ValueOf = T[keyof T]; /** * Based on https://stackoverflow.com/a/49725198 */ export type RequireOnlyOne = Pick> & { [K in Keys]-?: Required> & Partial, undefined>>; }[Keys]; export type Intersection = Omit)>, keyof (Omit)>; /** https://stackoverflow.com/a/66605669 */ type Only = { [P in keyof T]: T[P]; } & { [P in keyof U]?: never; }; export type Either = Only | Only; export type PartialExcept, TKeysNotPartial extends keyof T> = Partial & Pick; export declare function isArrayOf(v: unknown, check: (e: unknown) => boolean): v is T[]; export declare function isStringArray(v: unknown): v is string[]; export declare function isRecordOf(v: unknown, check: (e: unknown) => boolean): v is Record; export declare const collectionFromArray: (arr?: T[]) => IDMappedCollection; export declare const collectionToArray: ({ data, order }: IDMappedCollection) => T[]; export declare const collectionReplaceItem: (collection: IDMappedCollection, ...items: T[]) => { data: IDMappedObjects; order: T["id"][]; errors?: RelationOneToOne | undefined; warnings?: RelationOneToOne | undefined; }; export declare const collectionAddItem: (collection: IDMappedCollection, ...items: T[]) => { order: string[]; data: IDMappedObjects; errors?: RelationOneToOne | undefined; warnings?: RelationOneToOne | undefined; }; export declare const collectionRemoveItem: (collection: IDMappedCollection, item: T) => { data: IDMappedObjects; order: T["id"][]; errors?: RelationOneToOne | undefined; warnings?: RelationOneToOne | undefined; }; export declare const idMappedObjectsFromArr: (items: T[], current?: IDMappedObjects) => IDMappedObjects; export {};