Skip to content

Commit

Permalink
Merge pull request #2 from oriSomething/master
Browse files Browse the repository at this point in the history
Adding TypeScript typings
  • Loading branch information
alexreardon authored Apr 8, 2019
2 parents 06e96c2 + bf15898 commit d48dd86
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 17 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
type DependencyList = ReadonlyArray<any>;

declare function useMemoOne<T>(
// getResult changes on every call,
getResult: () => T,
// the inputs array changes on every call
inputs: DependencyList | undefined,
): T;

declare function useCallbackOne<T extends (...args: any[]) => any>(
// getResult changes on every call,
callback: T,
// the inputs array changes on every call
inputs: DependencyList | undefined,
): T;

export { useMemoOne, useCallbackOne };
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"sideEffects": false,
"files": [
"/dist",
"/src"
"/src",
"index.d.ts"
],
"author": "Alex Reardon <alexreardon@gmail.com>",
"license": "MIT",
Expand Down

0 comments on commit d48dd86

Please sign in to comment.