//#region src/field/set.d.ts declare namespace set { type Callback = (this: S, next: T, previous: T) => ((next: T) => void) | Promise | void | boolean; type Factory = (this: S, property: string) => Promise | T; } /** * Set a property as a placeholder, initially `undefined` but required. * * Property cannot be accessed until it is defined. If accessed while undefined, a hybrid * `Promise`/`Error` (aka: [Suspense](https://reactjs.org/docs/concurrent-mode-suspense.html)) will be thrown. * * Non-enumerable; writable only if `onUpdate` callback is provided. * * @param value - Starting value (undefined for suspense placeholder). * @param onUpdate - Callback run when property is set. */ declare function set(value?: undefined, onUpdate?: set.Callback): T; /** * Set property with an async factory function. * If required is not defined, factory runs lazily on first access. * If async, or returns a promise, suspense is thrown upon access until resolved. * * Non-enumerable and read-only. * * @param factory - Zero-arg async callback to produce property value. * @param required - Pass `true` to run factory immediately and require value. */ declare function set(factory: () => T | Promise, required?: true): T; /** * Set property with a lazy factory, no suspense. * * Non-enumerable and read-only. * * @param factory - Zero-arg callback to produce property value. * @param required - Pass `false` to allow undefined while pending. */ declare function set(factory: () => T | Promise, required: boolean): T | undefined; /** * Set property with a factory and update callback. * * Non-enumerable but writable via the callback. * * @param factory - Callback to produce initial value. * @param onUpdate - Callback run when property is updated. */ declare function set(factory: () => T | Promise, onUpdate: set.Callback): T; /** * Define a reactive computed property - the instruction equivalent of a getter. * * Unlike a zero-arg factory (which runs once and caches), the compute function * re-runs whenever any managed property it reads is updated. It receives the * instance as both `this` and its first argument, so arrow functions work. * * Enumerable and read-only, matching a prototype getter. Because it assigns * through an instruction rather than a concrete getter, subclasses may refine * the property's type with `declare`. * * @param compute - Function of arity >= 1; receives the instance to derive from. */ declare function set(compute: (this: S, self: S) => T): T; /** * Set a property with a non-function, non-Promise value. * * Non-enumerable but writable. Unlike plain assignment (`= value`), this * property is excluded from snapshots and `ref(this)`. * * @param value - Starting value for property. * @param onUpdate - Optional callback run when property is set. */ declare function set(value: T extends Promise ? never : T, onUpdate?: set.Callback): T; //#endregion export { set }; //# sourceMappingURL=set.d.ts.map