Skip to content

Commit 23a9124

Browse files
authored
Export more flow types (#200)
* Added prop types to flow export * Upgraded deps and fixed flow errors
1 parent 27bf0e0 commit 23a9124

File tree

8 files changed

+2538
-709
lines changed

8 files changed

+2538
-709
lines changed

package-lock.json

Lines changed: 2514 additions & 693 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,26 @@
2929
"devDependencies": {
3030
"@types/react": "^16.0.40",
3131
"babel-eslint": "^8.0.3",
32-
"babel-jest": "^22.4.1",
32+
"babel-jest": "^22.4.3",
3333
"babel-plugin-external-helpers": "^6.22.0",
3434
"babel-plugin-transform-flow-strip-types": "^6.22.0",
3535
"babel-preset-env": "^1.6.1",
3636
"babel-preset-react": "^6.24.1",
3737
"babel-preset-stage-2": "^6.24.1",
3838
"bundlesize": "^0.16.0",
3939
"doctoc": "^1.3.0",
40-
"eslint": "^4.18.2",
40+
"eslint": "^4.19.1",
4141
"eslint-config-react-app": "^2.1.0",
4242
"eslint-plugin-babel": "^4.1.2",
4343
"eslint-plugin-flowtype": "^2.46.1",
4444
"eslint-plugin-import": "^2.9.0",
4545
"eslint-plugin-jsx-a11y": "^6.0.2",
4646
"eslint-plugin-react": "^7.7.0",
47-
"final-form": "^4.3.0",
48-
"flow-bin": "^0.67.1",
47+
"final-form": "^4.4.0",
48+
"flow-bin": "^0.68.0",
4949
"glow": "^1.2.2",
5050
"husky": "^0.14.3",
51-
"jest": "^22.4.2",
51+
"jest": "^22.4.3",
5252
"lint-staged": "^7.0.0",
5353
"nps": "^5.8.2",
5454
"nps-utils": "^1.5.0",
@@ -59,11 +59,11 @@
5959
"raf": "^3.4.0",
6060
"react": "^16.2.0",
6161
"react-dom": "^16.2.0",
62-
"rollup": "^0.56.5",
62+
"rollup": "^0.57.1",
6363
"rollup-plugin-babel": "^3.0.2",
6464
"rollup-plugin-commonjs": "^9.1.0",
6565
"rollup-plugin-flow": "^1.1.1",
66-
"rollup-plugin-node-resolve": "^3.2.0",
66+
"rollup-plugin-node-resolve": "^3.3.0",
6767
"rollup-plugin-replace": "^2.0.0",
6868
"rollup-plugin-uglify": "^3.0.0",
6969
"tslint": "^5.9.1",

src/Field.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,18 @@ export default class Field extends React.Component<Props, State> {
141141
value = ''
142142
}
143143
const input = { name, value, ...this.handlers }
144-
if (rest.type === 'checkbox') {
144+
if ((rest: Object).type === 'checkbox') {
145145
if (_value === undefined) {
146146
input.checked = !!value
147147
} else {
148148
input.checked = !!(Array.isArray(value) && ~value.indexOf(_value))
149149
input.value = _value
150150
}
151-
} else if (rest.type === 'radio') {
151+
} else if ((rest: Object).type === 'radio') {
152152
input.checked = value === _value
153153
input.value = _value
154154
}
155-
if (component === 'select' && rest.multiple) {
155+
if (component === 'select' && (rest: Object).multiple) {
156156
input.value = input.value || []
157157
}
158158

src/FormSpy.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Form from './ReactFinalForm'
44
import Field from './Field'
55
import FormSpy from './FormSpy'
66

7-
const onSubmitMock = values => {}
7+
const onSubmitMock = () => {}
88
const hasFormApi = props => {
99
expect(typeof props.batch).toBe('function')
1010
expect(typeof props.blur).toBe('function')

src/ReactFinalForm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default class ReactFinalForm extends React.Component<Props, State> {
7979
this.unsubscriptions = []
8080
if (this.form) {
8181
// set initial state
82-
let initialState: FormState
82+
let initialState: FormState = {}
8383
this.form.subscribe((state: FormState) => {
8484
initialState = state
8585
}, subscription || all)()

src/getValue.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ const getValue = (
2121
if (
2222
!isReactNative &&
2323
event.nativeEvent &&
24-
event.nativeEvent.text !== undefined
24+
(event.nativeEvent: Object).text !== undefined
2525
) {
26-
return event.nativeEvent.text
26+
return (event.nativeEvent: Object).text
2727
}
2828
if (isReactNative && event.nativeEvent) {
2929
return (event.nativeEvent: any).text

src/index.js.flow

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
import * as React from 'react'
33
import type { FieldProps, FormProps, FormSpyProps } from './types'
44

5-
export type { ReactContext } from './types'
5+
export type {
6+
FieldProps,
7+
FieldRenderProps,
8+
FormProps,
9+
FormRenderProps,
10+
FormSpyProps,
11+
FormSpyRenderProps,
12+
ReactContext
13+
} from './types'
614

715
declare export var Field: React.ComponentType<FieldProps>
816
declare export var Form: React.ComponentType<FormProps>

src/renderComponent.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import renderComponent from './renderComponent'
33
describe('renderComponent', () => {
44
it('should pass both render and children prop', () => {
55
const children = 'some children'
6-
const render = () => 'examplary render function'
6+
const render = () => {}
77
const props = {
88
component: () => null,
99
children,

0 commit comments

Comments
 (0)