dagda1
dagda1

Reputation: 28770

Better type annotations for function props with flow

I have the following type definition for a component:

type Props = {
  address: {
    addressIndex: number,
    entryState: string
  },
  changeEntryState: Function,
  change: Function,
  untouch: Function,
  clearApplicantFields: Function
};

Function is very generic, is there anything I can do to make this more specific?

They are all redux actions and change and untouch come from redux-form.

Upvotes: 1

Views: 399

Answers (1)

temakozyrev
temakozyrev

Reputation: 372

for example

changeEntryState: (val: string) => number

or

changeEntryState: (str: string, bool?: boolean, ...nums: Array<number>) => void

Upvotes: 1

Related Questions