From 6065e2d4b5811030c48b911e78769b04cc4a1177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Tue, 28 Nov 2017 10:31:03 +0100 Subject: [PATCH 1/2] Use $Shape instead of optional fields --- src/types.js.flow | 70 +++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/types.js.flow b/src/types.js.flow index 24e8802f..31254f64 100644 --- a/src/types.js.flow +++ b/src/types.js.flow @@ -1,15 +1,15 @@ // @flow -import * as React from 'react' +import * as React from 'react'; import type { Api, Config, FormSubscription, - FieldSubscription -} from 'final-form' + FieldSubscription, +} from 'final-form'; export type ReactContext = { - reactFinalForm: Api -} + reactFinalForm: Api, +}; export type FieldRenderProps = { input: { @@ -17,52 +17,52 @@ export type FieldRenderProps = { onBlur: (?SyntheticFocusEvent<*>) => void, onChange: (SyntheticInputEvent<*> | any) => void, onFocus: (?SyntheticFocusEvent<*>) => void, - value: any + value: any, }, - meta: { - active?: boolean, - dirty?: boolean, - error?: boolean, - initial?: boolean, - invalid?: boolean, - pristine?: boolean, - submitError?: boolean, - submitFailed?: boolean, - submitSucceeded?: boolean, - touched?: boolean, - valid?: boolean, - visited?: boolean - }, - children?: React.Node -} + meta: $Shape<{ + active: boolean, + dirty: boolean, + error: boolean, + initial: boolean, + invalid: boolean, + pristine: boolean, + submitError: boolean, + submitFailed: boolean, + submitSucceeded: boolean, + touched: boolean, + valid: boolean, + visited: boolean, + }>, + children?: React.Node, +}; export type FormRenderProps = { blur: (name: string) => void, change: (name: string, value: any) => void, focus: (name: string) => void, handleSubmit: (SyntheticEvent) => void, - reset: () => void -} + reset: () => void, +}; -export type RenderableProps = { - component?: React.ComponentType<*>, - render?: (props: T) => React.Node, - children?: ((props: T) => React.Node) | React.Node -} +export type RenderableProps = $Shape<{ + component: React.ComponentType<*>, + render: (props: T) => React.Node, + children: ((props: T) => React.Node) | React.Node, +}>; export type FormProps = { - subscription: ?FormSubscription -} & Config & - RenderableProps + subscription: ?FormSubscription, +} & Config + & RenderableProps; export type FieldProps = { name: string, subscription?: FieldSubscription, allowNull?: boolean, validate?: (value: ?any, allValues: Object) => ?any, - value?: any -} & RenderableProps + value?: any, +} & RenderableProps; export type FormSpyProps = { subscription: ?FormSubscription -} & RenderableProps +} & RenderableProps; From 4056e0546593c8a4d66eca715ca0284dbd4940b8 Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Tue, 28 Nov 2017 11:30:47 +0100 Subject: [PATCH 2/2] Ran Prettier --- src/types.js.flow | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/types.js.flow b/src/types.js.flow index 31254f64..ea911484 100644 --- a/src/types.js.flow +++ b/src/types.js.flow @@ -1,15 +1,15 @@ // @flow -import * as React from 'react'; +import * as React from 'react' import type { Api, Config, FormSubscription, - FieldSubscription, -} from 'final-form'; + FieldSubscription +} from 'final-form' export type ReactContext = { - reactFinalForm: Api, -}; + reactFinalForm: Api +} export type FieldRenderProps = { input: { @@ -17,7 +17,7 @@ export type FieldRenderProps = { onBlur: (?SyntheticFocusEvent<*>) => void, onChange: (SyntheticInputEvent<*> | any) => void, onFocus: (?SyntheticFocusEvent<*>) => void, - value: any, + value: any }, meta: $Shape<{ active: boolean, @@ -31,38 +31,38 @@ export type FieldRenderProps = { submitSucceeded: boolean, touched: boolean, valid: boolean, - visited: boolean, + visited: boolean }>, - children?: React.Node, -}; + children?: React.Node +} export type FormRenderProps = { blur: (name: string) => void, change: (name: string, value: any) => void, focus: (name: string) => void, handleSubmit: (SyntheticEvent) => void, - reset: () => void, -}; + reset: () => void +} export type RenderableProps = $Shape<{ component: React.ComponentType<*>, render: (props: T) => React.Node, - children: ((props: T) => React.Node) | React.Node, -}>; + children: ((props: T) => React.Node) | React.Node +}> export type FormProps = { - subscription: ?FormSubscription, -} & Config - & RenderableProps; + subscription: ?FormSubscription +} & Config & + RenderableProps export type FieldProps = { name: string, subscription?: FieldSubscription, allowNull?: boolean, validate?: (value: ?any, allValues: Object) => ?any, - value?: any, -} & RenderableProps; + value?: any +} & RenderableProps export type FormSpyProps = { subscription: ?FormSubscription -} & RenderableProps; +} & RenderableProps