From d46ff7f0ab24261dc5e24eee1f449e09a648ce77 Mon Sep 17 00:00:00 2001 From: samchungy Date: Fri, 25 Oct 2024 12:02:13 +1100 Subject: [PATCH] Add typings for `this` --- src/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index 136ad88..f9b22e9 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -17,7 +17,7 @@ */ declare class DataLoader { constructor( - batchLoadFn: DataLoader.BatchLoadFn, + batchLoadFn: DataLoader.BatchLoadFn, options?: DataLoader.Options, ); @@ -80,7 +80,8 @@ declare namespace DataLoader { // A Function, which when given an Array of keys, returns a Promise of an Array // of values or Errors. - export type BatchLoadFn = ( + export type BatchLoadFn = ( + this: DataLoader, keys: ReadonlyArray, ) => PromiseLike>;