Skip to content

Commit 09b675a

Browse files
authored
Merge pull request #3 from MichaelDeBoey/typescript
Add TypeScript typings
2 parents 28adb59 + e7505f8 commit 09b675a

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

package-scripts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ module.exports = {
5555
description: 'Generates table of contents in README',
5656
script: 'doctoc README.md'
5757
},
58-
copyTypes: npsUtils.copy('src/*.js.flow dist'),
58+
copyTypes: npsUtils.copy('src/*.js.flow src/*.d.ts dist'),
5959
lint: {
6060
description: 'lint the entire project',
6161
script: 'eslint .'

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "dist/final-form-arrays.cjs.js",
66
"jsnext:main": "dist/final-form-arrays.es.js",
77
"module": "dist/final-form-arrays.es.js",
8+
"typings": "dist/index.d.js",
89
"files": ["dist"],
910
"scripts": {
1011
"start": "nps",

src/index.d.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Mutator } from 'final-form'
2+
3+
type DefaultType = { [key: string]: Mutator }
4+
5+
export default DefaultType
6+
7+
/** The shape of the mutators once final-form has bound them to state */
8+
export type Mutators = {
9+
insert: (name: string, index: number, value: any) => void
10+
move: (name: string, from: number, to: number) => void
11+
pop: (name: string) => any
12+
push: (name: string, value: any) => void
13+
remove: (name: string, index: number) => any
14+
shift: (name: string) => any
15+
swap: (name: string, indexA: number, indexB: number) => void
16+
unshift: (name: string, value: any) => void
17+
}

0 commit comments

Comments
 (0)