Skip to content

Commit

Permalink
fix(TS): Item can be null in onChange and onSelect (#611)
Browse files Browse the repository at this point in the history
  • Loading branch information
esamattis authored and silviuaavram committed Jan 29, 2019
1 parent f2b7b6f commit aecd730
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/basic.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class App extends React.Component<Props, State> {
items: ['apple', 'orange', 'carrot'],
}

onChange = (selectedItem: Item) => {
onChange = (selectedItem: Item | null) => {
console.log('selectedItem', selectedItem)
}

Expand Down
4 changes: 2 additions & 2 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ export interface DownshiftProps<Item> {
selectedItemChanged?: (prevItem: Item, item: Item) => boolean
getA11yStatusMessage?: (options: A11yStatusMessageOptions<Item>) => string
onChange?: (
selectedItem: Item,
selectedItem: Item | null,
stateAndHelpers: ControllerStateAndHelpers<Item>,
) => void
onSelect?: (
selectedItem: Item,
selectedItem: Item | null,
stateAndHelpers: ControllerStateAndHelpers<Item>,
) => void
onStateChange?: (
Expand Down

0 comments on commit aecd730

Please sign in to comment.