Skip to content

Commit d7eee2c

Browse files
Fix typing of addOperator Methods
These methods currently return void so don't mark their return type as map
1 parent 0de797c commit d7eee2c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

types/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ export class Engine {
2828
setCondition(name: string, conditions: TopLevelCondition): this;
2929
removeCondition(name: string): boolean;
3030

31-
addOperator(operator: Operator): Map<string, Operator>;
31+
addOperator(operator: Operator): void;
3232
addOperator<A, B>(
3333
operatorName: string,
3434
callback: OperatorEvaluator<A, B>
35-
): Map<string, Operator>;
35+
): void;
3636
removeOperator(operator: Operator | string): boolean;
3737

3838
addFact<T>(fact: Fact<T>): this;

types/index.test-d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ const operatorEvaluator: OperatorEvaluator<number, number> = (
7272
a: number,
7373
b: number
7474
) => a === b;
75-
expectType<Map<string, Operator>>(
75+
expectType<void>(
7676
engine.addOperator("test", operatorEvaluator)
7777
);
7878
const operator: Operator = new Operator(
7979
"test",
8080
operatorEvaluator,
8181
(num: number) => num > 0
8282
);
83-
expectType<Map<string, Operator>>(engine.addOperator(operator));
83+
expectType<void>(engine.addOperator(operator));
8484
expectType<boolean>(engine.removeOperator(operator));
8585

8686
// Fact tests

0 commit comments

Comments
 (0)