From edf16180fd3892b621b3003001c9053f010b13be Mon Sep 17 00:00:00 2001
From: John Whiles
Date: Wed, 8 Nov 2017 18:35:13 +0000
Subject: [PATCH] fix(TypeScript): update typescript definitions for downshift
components (#254)
* Add type signature for onSelect function
* Add other missing Downshift prop types
also update the contributors and readme in line with contributing
guidelines
* correct a typo
---
.all-contributorsrc | 9 +++++++++
README.md | 3 ++-
typings/index.d.ts | 27 ++++++++++++++++++---------
3 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/.all-contributorsrc b/.all-contributorsrc
index ca1749d0e..ec0442ddc 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -408,6 +408,15 @@
"code",
"test"
]
+ },
+ {
+ "login": "Jwhiles",
+ "name": "John Whiles",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/20307225?v=4",
+ "profile": "http://www.johnwhiles.com",
+ "contributions": [
+ "code"
+ ]
}
]
}
diff --git a/README.md b/README.md
index 351184fea..10d0bc6f2 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ autocomplete/dropdown/select/combobox components
[![version][version-badge]][package]
[![MIT License][license-badge]][LICENSE]
-[![All Contributors](https://img.shields.io/badge/all_contributors-42-orange.svg?style=flat-square)](#contributors)
+[![All Contributors](https://img.shields.io/badge/all_contributors-43-orange.svg?style=flat-square)](#contributors)
[![PRs Welcome][prs-badge]][prs]
[![Chat][chat-badge]][chat]
[![Code of Conduct][coc-badge]][coc]
@@ -657,6 +657,7 @@ Thanks goes to these people ([emoji key][emojis]):
| [![](https://avatars0.githubusercontent.com/u/1402095?v=4)
Matt Parrish](https://github.com/pbomb)
[π§](#tool-pbomb "Tools") [π](#review-pbomb "Reviewed Pull Requests") | [![](https://avatars1.githubusercontent.com/u/11661846?v=4)
thom](http://thom.kr)
[π»](https://github.com/paypal/downshift/commits?author=thomhos "Code") | [![](https://avatars2.githubusercontent.com/u/1088312?v=4)
Vu Tran](http://twitter.com/tranvu)
[π»](https://github.com/paypal/downshift/commits?author=vutran "Code") | [![](https://avatars1.githubusercontent.com/u/74193?v=4)
Codie Mullins](https://github.com/codiemullins)
[π»](https://github.com/paypal/downshift/commits?author=codiemullins "Code") [π‘](#example-codiemullins "Examples") | [![](https://avatars3.githubusercontent.com/u/12202757?v=4)
Mohammad Rajabifard](https://morajabi.me)
[π](https://github.com/paypal/downshift/commits?author=morajabi "Documentation") [π€](#ideas-morajabi "Ideas, Planning, & Feedback") | [![](https://avatars3.githubusercontent.com/u/9488719?v=4)
Frank Tan](https://github.com/tansongyang)
[π»](https://github.com/paypal/downshift/commits?author=tansongyang "Code") | [![](https://avatars3.githubusercontent.com/u/5093058?v=4)
Kier Borromeo](https://kierb.com)
[π‘](#example-srph "Examples") |
| [![](https://avatars1.githubusercontent.com/u/8969456?v=4)
Paul Veevers](https://github.com/paul-veevers)
[π»](https://github.com/paypal/downshift/commits?author=paul-veevers "Code") | [![](https://avatars2.githubusercontent.com/u/13622298?v=4)
Ron Cruz](https://github.com/Ronolibert)
[π](https://github.com/paypal/downshift/commits?author=Ronolibert "Documentation") | [![](https://avatars1.githubusercontent.com/u/13605633?v=4)
Rick McGavin](http://rickmcgavin.github.io)
[π](https://github.com/paypal/downshift/commits?author=rickMcGavin "Documentation") | [![](https://avatars0.githubusercontent.com/u/869669?v=4)
Jelle Versele](http://twitter.com/vejersele)
[π‘](#example-vejersele "Examples") | [![](https://avatars1.githubusercontent.com/u/202773?v=4)
Brent Ertz](https://github.com/brentertz)
[π€](#ideas-brentertz "Ideas, Planning, & Feedback") | [![](https://avatars3.githubusercontent.com/u/8015514?v=4)
Justice Mba ](https://github.com/Dajust)
[π»](https://github.com/paypal/downshift/commits?author=Dajust "Code") [π](https://github.com/paypal/downshift/commits?author=Dajust "Documentation") [π€](#ideas-Dajust "Ideas, Planning, & Feedback") | [![](https://avatars2.githubusercontent.com/u/3925281?v=4)
Mark Ellis](http://mfellis.com)
[π€](#ideas-ellismarkf "Ideas, Planning, & Feedback") |
| [![](https://avatars1.githubusercontent.com/u/3241922?v=4)
usΝ‘anΜΈdfΝrienΝdsΝ ](http://ronak.io/)
[π](https://github.com/paypal/downshift/issues?q=author%3Ausandfriends "Bug reports") [π»](https://github.com/paypal/downshift/commits?author=usandfriends "Code") [β οΈ](https://github.com/paypal/downshift/commits?author=usandfriends "Tests") | [![](https://avatars0.githubusercontent.com/u/474248?v=4)
Robin Drexler](https://www.robin-drexler.com/)
[π](https://github.com/paypal/downshift/issues?q=author%3Arobin-drexler "Bug reports") [π»](https://github.com/paypal/downshift/commits?author=robin-drexler "Code") | [![](https://avatars0.githubusercontent.com/u/7406639?v=4)
Arturo Romero](http://arturoromero.info/)
[π‘](#example-arturoromeroslc "Examples") | [![](https://avatars0.githubusercontent.com/u/3998604?v=4)
Dave Garwacke](http://www.warbyparker.com)
[π](https://github.com/paypal/downshift/commits?author=ifyoumakeit "Documentation") | [![](https://avatars3.githubusercontent.com/u/11758660?v=4)
Ivan Pazhitnykh](http://linkedin.com/in/drapegnik)
[π»](https://github.com/paypal/downshift/commits?author=Drapegnik "Code") [β οΈ](https://github.com/paypal/downshift/commits?author=Drapegnik "Tests") | [![](https://avatars0.githubusercontent.com/u/61776?v=4)
Luis Merino](https://github.com/Rendez)
[π](https://github.com/paypal/downshift/commits?author=Rendez "Documentation") | [![](https://avatars0.githubusercontent.com/u/8746094?v=4)
Andrew Hansen](http://twitter.com/arahansen)
[π»](https://github.com/paypal/downshift/commits?author=arahansen "Code") [β οΈ](https://github.com/paypal/downshift/commits?author=arahansen "Tests") |
+| [![](https://avatars3.githubusercontent.com/u/20307225?v=4)
John Whiles](http://www.johnwhiles.com)
[π»](https://github.com/paypal/downshift/commits?author=Jwhiles "Code") |
This project follows the [all-contributors][all-contributors] specification.
diff --git a/typings/index.d.ts b/typings/index.d.ts
index 5024a6878..e9947000f 100644
--- a/typings/index.d.ts
+++ b/typings/index.d.ts
@@ -1,33 +1,42 @@
import * as React from 'react'
export interface DownshiftProps {
- children: ChildrenFunction
- defaultHighlightedIndex?: number | null
defaultSelectedItem?: any
+ defaultHighlightedIndex?: number | null
defaultInputValue?: string
defaultIsOpen?: boolean
- getA11yStatusMessage?: (options: A11yStatusMessageOptions) => any
itemToString?: (item: any) => string
+ selectedItemChanged?: (prevItem: any, item: any) => boolean
+ getA11yStatusMessage?: (options: A11yStatusMessageOptions) => any
onChange?: (
selectedItem: any,
stateAndHelpers: ControllerStateAndHelpers,
) => void
- onOuterClick?: () => void
+ onSelect?: (
+ selectedItem: any,
+ stateAndHelpers: ControllerStateAndHelpers,
+ ) => void
onStateChange?: (
options: StateChangeOptions,
stateAndHelpers: ControllerStateAndHelpers,
) => void
- onUserAction?: (
- options: StateChangeOptions,
+ onInputValueChange?: (
+ inputValue: string,
stateAndHelpers: ControllerStateAndHelpers,
) => void
itemCount?: number
- selectedItem?: any
- isOpen?: boolean
- inputValue?: string
highlightedIndex?: number
+ inputValue?: string
+ isOpen?: boolean
+ selectedItem?: any
+ children: ChildrenFunction
id?: string
environment?: Environment
+ onOuterClick?: () => void
+ onUserAction?: (
+ options: StateChangeOptions,
+ stateAndHelpers: ControllerStateAndHelpers,
+ ) => void
}
export interface Environment {