diff --git a/types/circuit-breaker-js/circuit-breaker-js-tests.ts b/types/circuit-breaker-js/circuit-breaker-js-tests.ts index 1436e13e90..b9a3c70a63 100644 --- a/types/circuit-breaker-js/circuit-breaker-js-tests.ts +++ b/types/circuit-breaker-js/circuit-breaker-js-tests.ts @@ -10,3 +10,11 @@ status = CircuitBreaker.OPEN; breaker.forceOpen(); breaker.forceClose(); + +breaker.run((success, failure) => { + if (Math.random() > 0.5) { + success(); + } else { + failure(); + } +}); diff --git a/types/circuit-breaker-js/index.d.ts b/types/circuit-breaker-js/index.d.ts index 6fc58bd40d..7b6854e61f 100644 --- a/types/circuit-breaker-js/index.d.ts +++ b/types/circuit-breaker-js/index.d.ts @@ -30,7 +30,13 @@ declare class CircuitBreaker { static CLOSED: 2; constructor(options?: CircuitBreaker.Options); - run(command: () => void, fallback?: () => void): void; + run( + command: ( + success: () => void, + failure: () => void, + ) => void, + fallback?: () => void + ): void; forceClose(): void; forceOpen(): void; unforce(): void;