Skip to content

Commit 7a90a81

Browse files
add toJSON method to RuleResult
1 parent ae8fa05 commit 7a90a81

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

types/index.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,20 @@ export type RuleSerializable = Pick<
153153
"conditions" | "event" | "name" | "priority"
154154
>;
155155

156+
export type RuleResultSerializable = Pick<
157+
Required<RuleResult>,
158+
"name" | "conditions" | "event" | "priority" | "result">
159+
156160
export interface RuleResult {
157161
name: string;
158162
conditions: TopLevelCondition;
159163
event?: Event;
160164
priority?: number;
161165
result: any;
166+
toJSON(): string;
167+
toJSON<T extends boolean>(
168+
stringify: T
169+
): T extends true ? string : RuleResultSerializable;
162170
}
163171

164172
export class Rule implements RuleProperties {

0 commit comments

Comments
 (0)