From c1ad1a0518732835e28a7159368ba9b7b96f27d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Tue, 12 Feb 2019 11:40:26 +0100 Subject: [PATCH] Add TS types --- index.d.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..6d1b2e2 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,15 @@ +import { Decorator, FormState } from 'final-form' + +type FocusableInput = { + name: string, + focus: () => void, +} + +type GetInputs = () => FocusableInput[] +type FindInput = (inputs: FocusableInput[], errors: FormState['errors']) => FocusableInput[] + +declare const createDecorator: (getInputs?: GetInputs, findInput?: FindInput) => Decorator +declare const getFormInputs: (name: string) => GetInputs + +export default createDecorator +export { getFormInputs }