reactant-module
Version:
A module model for Reactant
40 lines • 975 B
TypeScript
import { Service } from '../interfaces';
declare const getStagedState: () => Record<string, unknown> | undefined;
/**
* ## Description
*
* `@action` is used to decorate a class method as a action method.
*
* ## Example
*
* ```ts
* @injectable()
* class Counter {
* @state
* count = 0;
*
* @action
* increase() {
* this.count += 1;
* }
* }
*
* const app = testBed({
* modules: [],
* main: Counter,
* });
*
* app.instance.increase();
* expect(app.instance.count).toBe(1);
* ```
*/
declare const action: (target: object, key: string, descriptor: TypedPropertyDescriptor<(...args: any[]) => void>) => {
value: (this: Service, ...args: unknown[]) => void;
enumerable?: boolean;
configurable?: boolean;
writable?: boolean;
get?: (() => (...args: any[]) => void) | undefined;
set?: ((value: (...args: any[]) => void) => void) | undefined;
};
export { getStagedState, action };
//# sourceMappingURL=action.d.ts.map