import type { Option } from "./option"; import type { Result } from "./result"; /** Unique symbol to brand atoms */ declare const __atom__: unique symbol; /** Atom type carrying the original name for hover/type info */ export type Atom = symbol & { readonly [__atom__]: T; }; /** Methods available on an Atom */ export interface AtomMethods { /** Returns the same atom */ to(target: "atom"): Atom; /** * Returns `Option` using the atom description. * @example atom("ready").to("option") // Some("ready") */ to(target: "option"): Option; /** * Returns `Ok` using the atom description. * @example atom("ready").to("result") // Ok("ready") */ to(target: "result"): Result; /** * Transforms the atom description, returns new Atom. * - If fn returns `undefined`, returns original Atom (no new allocation). * - If fn returns non-string, panics. * - If fn throws, panics. * - Sync only (no async support for Atom). * @example * atom("hello").andThen(s => s.toUpperCase()); // Atom("HELLO") * atom("test").andThen(s => undefined); // Atom("test") - original */ andThen(fn: (value: T) => U | undefined): Atom & AtomMethods; } /** * Sets the _to converter function (called from to.ts to break circular dep). * @internal */ export declare function setToConverter(fn: (value: any, target: string) => any): void; /** * Creates a new, unique atom (non-interned). * - Atoms are symbols with additional methods for type-safe conversions. * @param name - Name of the atom (used for hover/description). * @returns `Atom` with chainable `to()` method for conversions. * @example * const ready = atom("ready"); * ready.to("option"); // Some("ready") * ready.to("result"); // Ok("ready") */ export declare function atom(name: T): Atom & AtomMethods; export {};