async-memoize-one
async-memoize-one copied to clipboard
Add type annotation
Can you add the type annotation to simplify the usage of this library in typescript?
declare module 'async-memoize-one' {
import asyncMemoizeOne from "async-memoize-one";
declare function asyncMemoizeOne<T>(callback: (...args: any[]) => Promise<T>): (...args: any[]) => Promise<T>;
export default asyncMemoizeOne;
}
Hey, I will be happy to accept a PR for this 🙂
Just wanted to suggest a bit more strongly typed function definition:
declare module 'async-memoize-one' {
declare function asyncMemoizeOne<TFn extends (...params: any[]) => Promise<any>>(
callback: TFn,
): TFn;
export default asyncMemoizeOne;
}
I might add a PR if I have some time