/** * @description 条件逻辑接口 */ interface ICondition { name: string; conditionHandler: (name: string, ...args: any[]) => boolean; truthyHandler: (truthy: this) => void; falsyHandler: (falsy: this) => void; emit(): this; } declare type ConditionFn = (config: C, name: string) => boolean | undefined; declare type TruthyFn = (obj: O) => void; declare type FalsyFn = (obj: O) => void; declare class Chained implements ICondition { name: string; protected parent: Parent; protected conditionHandler: ConditionFn; protected truthyHandler: TruthyFn; protected falsyHandler: FalsyFn; constructor(name: string, parent: Parent); end(): Parent; batch(handler: (obj: this) => void): this; condition(conditionHandler: ConditionFn): this; truthy(truthyHandler: TruthyFn): this; falsy(falsyHandler: FalsyFn): this; when(conditionHandler: ConditionFn, truthyHandler?: TruthyFn, falsyHandler?: FalsyFn): this; emit(config?: C): this; } export default Chained;