Skip to content

Commit

Permalink
Make on & history properties type safer
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmosh committed Nov 21, 2022
1 parent 5efcfe3 commit 22f1799
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ type QueryMethodType = typeof queryMethods[number];
export class Tracker {
public readonly history = Object.fromEntries(
queryMethods.map((method) => [method, [] as RawQuery[]])
);
) as Record<QueryMethodType, RawQuery[]>;

public on = Object.fromEntries(
public readonly on = Object.fromEntries(
queryMethods.map((method) => [method, this.prepareStatement(method)])
);
) as Record<QueryMethodType, (rawQueryMatcher: QueryMatcher) => ResponseTypes>;

private readonly config: TrackerConfig;
private responses = new Map<RawQuery['method'], Handler[]>();
Expand Down

0 comments on commit 22f1799

Please sign in to comment.