import { InjectSelectorOptions } from "./injectSelector.js"; import { Atom } from "@tanstack/store"; //#region src/injectAtom.d.ts /** * A callable signal that reads the current atom value when invoked and * exposes a `.set` method matching the atom's native setter contract. * * This is the Angular-idiomatic return type for {@link injectAtom}. It can * be used as a class property and called directly in templates. * * @example * ```ts * readonly count = injectAtom(countAtom) * * // read in template: {{ count() }} * // write in class: this.count.set(5) * // this.count.set(prev => prev + 1) * ``` */ interface WritableAtomSignal { /** Read the current value. */ (): T; /** Set the atom value (accepts a direct value or an updater function). */ set: Atom['set']; } /** * Returns a {@link WritableAtomSignal} that reads the current atom value when * called and exposes a `.set` method for updates. * * Use this when a component needs to both read and update the same writable * atom. * * @example * ```ts * readonly count = injectAtom(countAtom) * * increment() { * this.count.set((prev) => prev + 1) * } * ``` */ declare function injectAtom(atom: Atom, options?: InjectSelectorOptions): WritableAtomSignal; //#endregion export { WritableAtomSignal, injectAtom }; //# sourceMappingURL=injectAtom.d.ts.map