From 6638c1a211230b69c3183bce7ddc3c8f0fa0448a Mon Sep 17 00:00:00 2001 From: liaoyinglong Date: Mon, 29 Apr 2019 10:18:50 +0800 Subject: [PATCH] feat: add type define for createMemo --- src/createMemo.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/createMemo.ts b/src/createMemo.ts index 1a95dd06..9b796877 100644 --- a/src/createMemo.ts +++ b/src/createMemo.ts @@ -1,5 +1,6 @@ import { useMemo } from 'react'; -const createMemo = fn => (...args) => useMemo(() => fn(...args), args); +const createMemo = any>(fn: T) => (...args: Parameters) => + useMemo>(() => fn(...args), args); export default createMemo;