Skip to content

Commit d46ff7f

Browse files
committed
Add typings for this
1 parent 77c2cd7 commit d46ff7f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.d.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818
declare class DataLoader<K, V, C = K> {
1919
constructor(
20-
batchLoadFn: DataLoader.BatchLoadFn<K, V>,
20+
batchLoadFn: DataLoader.BatchLoadFn<K, V, C>,
2121
options?: DataLoader.Options<K, V, C>,
2222
);
2323

@@ -80,7 +80,8 @@ declare namespace DataLoader {
8080

8181
// A Function, which when given an Array of keys, returns a Promise of an Array
8282
// of values or Errors.
83-
export type BatchLoadFn<K, V> = (
83+
export type BatchLoadFn<K, V, C = K> = (
84+
this: DataLoader<K, V, C>,
8485
keys: ReadonlyArray<K>,
8586
) => PromiseLike<ArrayLike<V | Error>>;
8687

0 commit comments

Comments
 (0)