-
-
Notifications
You must be signed in to change notification settings - Fork 70
/
index.d.ts
50 lines (46 loc) 路 1.43 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import * as React from 'react'
import { FieldSubscription, FieldState } from 'final-form'
export const version: string
export const FieldArray: React.ComponentType<FieldArrayProps>
export interface FieldArrayRenderProps {
fields: {
forEach: (iterator: (name: string, index: number) => void) => void
insert: (index: number, value: any) => void
map: (iterator: (name: string, index: number) => any) => any[]
move: (from: number, to: number) => void
name: string
pop: () => any
push: (value: any) => void
remove: (index: number) => any
shift: () => any
swap: (indexA: number, indexB: number) => void
unshift: (value: any) => void
} & FieldState
meta: Partial<{
// TODO: Make a diff of `FieldState` without all the functions
active: boolean
dirty: boolean
dirtySinceLastSubmit: boolean
error: boolean
initial: boolean
invalid: boolean
pristine: boolean
submitError: boolean
submitFailed: boolean
submitSucceeded: boolean
touched: boolean
valid: boolean
visited: boolean
}>
}
export interface RenderableProps<T> {
children?: ((props: T) => React.ReactNode) | React.ReactNode
component?: React.ComponentType<T> | string
render?: (props: T) => React.ReactNode
}
export interface FieldArrayProps
extends RenderableProps<FieldArrayRenderProps> {
name: string
subscription?: FieldSubscription
validate?: (value: any, allValues: object) => any
}