import { ObjectConfig } from "./config"; import { type SupportedTemporal } from "./temporal"; import { InputAndMap, QueryAndMap, UseFormStateOpts } from "./useFormState"; export type Builtin = Date | Function | SupportedTemporal | Uint8Array | string | number | boolean; export type Primitive = undefined | null | boolean | string | number | Function | Date | { toJSON(): any; }; /** Makes the keys in `T` required while keeping the values undefined. */ export type DeepRequired = T extends Primitive ? T : { [P in keyof Required]: T[P] extends Array ? Array> : T[P] extends ReadonlyArray ? ReadonlyArray> : DeepRequired; }; export type OmitIf = Pick; export declare function fail(message?: string): never; export declare function assertNever(x: never): never; /** Introspects the `init` prop to see if it has a `map` function/etc. and returns the form value. */ export declare function initValue(config: ObjectConfig, init: any): T; export declare function isInput(init: UseFormStateOpts["init"]): init is InputAndMap; export declare function isQuery(init: UseFormStateOpts["init"]): init is QueryAndMap; /** * Picks ony fields out of `instance` that are in the `formConfig`. * * This is useful for creating a form input from a GraphQL query result, * but ignoring extra data in the query that we don't want/need in the form. * * (Especially because the form.value will become our mutation's input type * that goes on the wire, we don't want superfluous data in it.) */ export declare function pickFields(formConfig: ObjectConfig, instance: I): { [K in keyof T]: K extends keyof I ? I[K] : never; }; export declare function isNotUndefined(value: T | undefined): value is T; export declare function isEmpty(value: any): boolean; /** * An equals that does deep-ish equality. * * We only do non-identity equals for: * * - "plain" objects that have no custom prototype/i.e. are object literals * - objects that implement `toJSON` * - arrays */ export declare function areEqual(a?: T, b?: T, strictOrder?: boolean): boolean; export declare function hasToJSON(o?: unknown): o is { toJSON(): void; }; /** Normalizes values into stable object-hash-safe data using our existing `toJSON` semantics. */ export declare function normalizeHashValue(value: unknown, seen?: WeakMap): unknown; /** Make a clone of `obj`, but only recurse into POJOs and Arrays...and stores. */ export declare function deepClone(obj: T, map?: WeakMap): T; export declare function groupBy(list: readonly T[], fn: (x: T) => K, valueFn?: (x: T) => Y): Map;