feat: template type on store APIs

This commit is contained in:
fryorcraken.eth 2022-09-21 16:10:27 +10:00
parent 879734b780
commit cc3b46ffbb
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 4 additions and 4 deletions

View File

@ -106,7 +106,7 @@ export class WakuStore {
*/
async queryOrderedCallback<T extends Message>(
decoders: Decoder<T>[],
callback: (message: Message) => Promise<void | boolean> | boolean | void,
callback: (message: T) => Promise<void | boolean> | boolean | void,
options?: QueryOptions
): Promise<void> {
const abort = false;
@ -156,7 +156,7 @@ export class WakuStore {
async queryCallbackOnPromise<T extends Message>(
decoders: Decoder<T>[],
callback: (
message: Promise<Message | undefined>
message: Promise<T | undefined>
) => Promise<void | boolean> | boolean | void,
options?: QueryOptions
): Promise<void> {
@ -194,7 +194,7 @@ export class WakuStore {
async *queryGenerator<T extends Message>(
decoders: Decoder<T>[],
options?: QueryOptions
): AsyncGenerator<Promise<Message | undefined>[]> {
): AsyncGenerator<Promise<T | undefined>[]> {
let startTime, endTime;
if (options?.timeFilter) {
@ -245,7 +245,7 @@ export class WakuStore {
if (!connection) throw "Failed to get a connection to the peer";
for await (const messages of paginate(
for await (const messages of paginate<T>(
connection,
protocol,
queryOpts,