Skip to content

Commit 7629c34

Browse files
chris-pardychris-pardy-newfire
authored andcommitted
Fix typing of addOperator Methods
These methods currently return void so don't mark their return type as map
1 parent d20bd68 commit 7629c34

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
@@ -35,11 +35,11 @@ export class Engine {
3535
setCondition(name: string, conditions: TopLevelCondition): this;
3636
removeCondition(name: string): boolean;
3737

38-
addOperator(operator: Operator): Map<string, Operator>;
38+
addOperator(operator: Operator): void;
3939
addOperator<A, B>(
4040
operatorName: string,
4141
callback: OperatorEvaluator<A, B>
42-
): Map<string, Operator>;
42+
): void;
4343
removeOperator(operator: Operator | string): boolean;
4444

4545
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)