import type { CustomSerialize, FormError, Serialize } from '@conform-to/dom/future';
import type { StandardSchemaV1 } from './standard-schema';
import { ValidateHandler, ValidateResult, BaseFieldMetadata, ConditionalFieldMetadata } from './types';
export declare function isUndefined(value: unknown): value is undefined;
export declare function isString(value: unknown): value is string;
export declare function isNumber(value: unknown): value is number;
export declare function isNullable<T>(value: unknown, typeGuard: (value: unknown) => value is T): value is T | null;
export declare function isOptional<T>(value: unknown, typeGuard: (value: unknown) => value is T): value is T | undefined;
export declare function getPathArray<Type>(formValue: Record<string, Type> | null, name: string): Array<Type>;
/**
 * Immutably updates a value at the specified path.
 * Empty path replaces the entire object.
 */
export declare function updatePathValue<Data>(data: Record<string, Data>, name: string, value: Data | Record<string, Data>): Record<string, Data>;
/**
 * Creates a function that updates array indices in field paths.
 * Returns null to remove fields, or updated path with new index.
 */
export declare function createPathIndexUpdater(listName: string, update: (index: number) => number | null): (name: string) => string | null;
export declare function resolveSerialize(customSerialize: CustomSerialize | undefined, defaultSerialize: Serialize): Serialize;
export declare function normalizeValidateResult<ErrorShape, Value>(result: ValidateResult<ErrorShape, Value>): {
    error: FormError<ErrorShape> | null;
    value?: Value;
};
/**
 * Handles different validation result formats:
 * - Promise: async validation only
 * - Array: [syncResult, asyncPromise]
 * - Object: sync validation only
 */
export declare function resolveValidateResult<ErrorShape, Value>(result: ReturnType<ValidateHandler<ErrorShape, Value>>): {
    syncResult: {
        error: FormError<ErrorShape> | null;
        value?: Value | undefined;
    } | undefined;
    asyncResult: Promise<{
        error: FormError<ErrorShape> | null;
        value?: Value | undefined;
    }> | undefined;
};
/**
 * Resolves a StandardSchema validation result to conform's format.
 */
export declare function resolveStandardSchemaResult<Value>(result: StandardSchemaV1.Result<Value>): {
    error: FormError<string[]> | null;
    value?: Value;
};
/**
 * Create a copy of the object with the updated properties if there is any change
 */
export declare function merge<Obj extends Record<string, any>>(obj: Obj, update: Partial<Obj>): Obj;
/**
 * Transforms object keys using a mapping function.
 * Keys mapped to null are filtered out.
 */
export declare function transformKeys<Value>(obj: Record<string, Value>, fn: (key: string) => string | null): Record<string, Value>;
/**
 * Appends item to array only if not already present.
 * Returns original array if item exists, new array if added.
 */
export declare function appendUniqueItem<Item>(list: Array<Item>, item: Item): Item[];
/**
 * Maps over array and filters out null results.
 */
export declare function compactMap<Item>(list: Array<NonNullable<Item>>, fn: (value: Item) => Item | null): Array<Item>;
export declare function generateUniqueKey(): string;
/**
 * Creates a type-only marker for TypeScript inference.
 *
 * This function always returns `true` at runtime. It exists
 * purely to capture the generic type parameter for compile-time type checking.
 * No runtime validation is performed.
 *
 * Common uses:
 * - `isError`: Specify the error shape for type inference
 * - `when`: Narrow field metadata to specific shapes for conditional props
 *
 * **Example: Specify error shape**
 * ```ts
 * configureForms({
 *   isError: shape<string[]>(),  // errors are string arrays
 * });
 * ```
 *
 * **Example: Conditional field metadata**
 * ```ts
 * extendFieldMetadata(metadata, { when }) {
 *   return {
 *     get dateRangePickerProps() {
 *       return when(metadata, shape<{ start: string; end: string }>(), (m) => ({
 *         startName: m.getFieldset().start.name,
 *         endName: m.getFieldset().end.name,
 *       }));
 *     },
 *   };
 * }
 * ```
 */
export declare function shape<T>(): (value: unknown) => value is T;
/**
 * Creates a conditional field metadata property that is only available
 * when the field shape matches the specified type.
 */
export declare function when<FieldShape, ErrorShape, Metadata>(metadata: BaseFieldMetadata<unknown, ErrorShape>, _shape: (value: unknown) => value is FieldShape, fn: (m: BaseFieldMetadata<FieldShape, ErrorShape>) => Metadata): ConditionalFieldMetadata<Metadata, FieldShape>;
export declare function isStandardSchemaV1(schema: unknown): schema is StandardSchemaV1;
export declare function validateStandardSchemaV1<Schema extends StandardSchemaV1>(schema: Schema, payload: Record<string, unknown>): any;
//# sourceMappingURL=util.d.ts.map