import type { FormField } from '../../types'; /** * Defines a typed object entry */ export type Entry = { [K in keyof T]: [K, T[K]]; }[keyof T]; /** * Converts a `Map` type to its equivalent when performing `[...map.entries()]`. * @example ```typescript * const map: MapType = new Map(['key', 'value']); * const entries = [...map.entries()]; // Same type as MapEntries * * typeof entries === MapEntries * ``` */ export type MapEntries = MapToConvert extends Map ? [Key, Value][] : never; /** * Check if value is a string */ export declare const isString: (value: unknown) => value is string; /** * Check if value is a number */ export declare const isNumber: (value: unknown) => value is number; /** * Check if value is a boolean */ export declare const isBoolean: (value: unknown) => value is boolean; /** * Check if value undefined */ export declare const isUndefined: (value: unknown) => value is undefined; /** * Makes sure a value is not `null` or `undefined`. * Useful for type safety when filtering empty elements from an array. Check out the example for more in-depth explanation. * @param value The value to type-check. * @example ```typescript * const items = [1, null, 4, undefined, 8]; * * const filteredItemsError: number[] = items.filter((item) => value !== undefined && value !== null); // Type '(number | null | undefined)[]' is not assignable to type 'number[]'. * * const filteredItemsSuccess: number[] = items.filter(isNotEmpty); // Success! * ``` */ export declare const isNotEmpty: (value: T | null | undefined) => value is T; /** * Check if a key is included in a readonly array * @param key * @param source readonly array of strings * @returns True/false */ export declare const isKeyOf: (key: string | null | undefined, source: readonly T[]) => key is (typeof source)[number]; /** * Gets the keys of an object with inferred typing. * @param object * @returns */ export declare const getObjectKeys: >(object: T) => (keyof T)[]; /** * Gets type safe `Object.entries()`. * @param object */ export declare const getObjectEntries: >>(object: T) => Entry[]; /** * @returns `true` if the target is an instance of Element type. * @param target */ export declare const isElement: (target: unknown) => target is Element; /** * @returns `true` if the target is an instance of HTMLElement type. * @param target */ export declare const isHTMLElement: (target: unknown) => target is HTMLElement; /** * @returns `true` if the target is an instance of HTMLVideoElement type. * @param target */ export declare const isHTMLVideoElement: (target: unknown) => target is HTMLVideoElement; /** * @returns `true` if the target is an instance of HTMLInputElement type. * @param target */ export declare const isHTMLInputElement: (target: unknown) => target is HTMLInputElement; /** * @returns `true` if the target is an instance of HTMLSelectElement type. * @param target */ export declare const isHTMLSelectElement: (target: unknown) => target is HTMLSelectElement; /** * @returns `true` if the target is an instance of HTMLTextAreaElement type. * @param target */ export declare const isHTMLTextAreaElement: (target: unknown) => target is HTMLTextAreaElement; /** * Checks if an element is a form field element * @param element */ export declare const isFormField: (element: Element | EventTarget | null) => element is FormField; /** * @returns `true` if the target is an instance of HTMLAnchorElement type. * @param target */ export declare const isHTMLAnchorElement: (target: unknown) => target is HTMLAnchorElement; /** * @returns `true` if the target is an instance of HTMLOptionElement type. * @param target */ export declare const isHTMLOptionElement: (target: unknown) => target is HTMLOptionElement; /** * @returns `true` if the target is an instance of HTMLImageElement type. * @param target */ export declare const isHTMLImageElement: (target: unknown) => target is HTMLImageElement; /** * @returns `true` if the target is an instance of HTMLButtonElement type. * @param target */ export declare const isHTMLButtonElement: (target: unknown) => target is HTMLButtonElement; /** * @returns `true` if the target is an instance of File type. * @param target */ export declare const isFile: (target: unknown) => target is File;