import { C as Class, M as MixinConstructorArgs, U as UnknownArgs, F as Fun } from '../types-C31Pn_8-.js'; /** * # Autobind * * Automatically binds all class methods to the instance. * * ```typescript * import { autobind } from 'aspectra/utils' * * @autobind * class Greeting { * private readonly name = 'John' * * public hello() { * console.log(`Hello from ${this.name}`) * } * * public farewell() { * console.log(`Goodbye from ${this.name}`) * } * } * * const { hello, farewell } = new Greeting() * hello() * farewell() * ``` */ declare function autobind>(target: T, _: ClassDecoratorContext): T; /** * # Bound * * Binds a class method to its instance. * * ```typescript * import { bound } from 'aspectra/utils' * * class Example { * private readonly name = 'John' * * @bound public greet() { * console.log(`Hello from ${this.name}`) * } * } * * const { greet } = new Example() * greet() * ``` */ declare function bound(target: Fun, context: ClassMethodDecoratorContext): void; type Unit = 'Years' | 'Year' | 'Yrs' | 'Yr' | 'Y' | 'Weeks' | 'Week' | 'W' | 'Days' | 'Day' | 'D' | 'Hours' | 'Hour' | 'Hrs' | 'Hr' | 'H' | 'Minutes' | 'Minute' | 'Mins' | 'Min' | 'M' | 'Seconds' | 'Second' | 'Secs' | 'Sec' | 's' | 'Milliseconds' | 'Millisecond' | 'Msecs' | 'Msec' | 'Ms'; type UnitAnyCase = Unit | Uppercase | Lowercase; type TimeString = `${number}` | `${number}${UnitAnyCase}` | `${number} ${UnitAnyCase}`; type Serializable = string | number | boolean | bigint | null | undefined | { [_: string]: Serializable; } | Serializable[] | Date; /** * # Cached * * Similar to `memoized`, but with an expiration time. * * * Duration can be specified in milliseconds or using a human-readable * string, powered by [`ms`](https://github.com/vercel/ms?tab=readme-ov-file#ms). * * * ```typescript * import { cached } from 'aspectra/utils' * * class Database { * @cached('2h') public queryAll() { * // sql: SELECT * FROM table * } * } * ``` */ declare function cached(duration: TimeString | number): (target: Fun, context: ClassMethodDecoratorContext) => void; /** * # Memoized * * Memoizes the method. Usful for optimizing expensive computations. * * ```typescript * import { memoized } from 'aspectra/utils' * * class Calculator { * @memoized public square(num: number): number { * console.log('Calculating...') * return num * num * } * } * * const calculator = new Calculator() * console.log(calculator.square(2)) * console.log(calculator.square(2)) * ``` */ declare function memoized(target: Fun, context: ClassMethodDecoratorContext): void; /** * # Sealed * * Seals a class, preventing it from being extended. * * * Error is thrown when attempting to instantiate a derived class. * * * ```typescript * import { sealed } from 'aspectra/utils' * * @sealed * class Base {} * * class Derived extends Base {} * * try { * new Derived() * } catch (error) { * console.table(error) * } * ``` */ declare function sealed>(target: T, _: ClassDecoratorContext): T; export { autobind, bound, cached, memoized, sealed };