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]): | [
Matt Parrish](https://github.com/pbomb)
[πŸ”§](#tool-pbomb "Tools") [πŸ‘€](#review-pbomb "Reviewed Pull Requests") | [
thom](http://thom.kr)
[πŸ’»](https://github.com/paypal/downshift/commits?author=thomhos "Code") | [
Vu Tran](http://twitter.com/tranvu)
[πŸ’»](https://github.com/paypal/downshift/commits?author=vutran "Code") | [
Codie Mullins](https://github.com/codiemullins)
[πŸ’»](https://github.com/paypal/downshift/commits?author=codiemullins "Code") [πŸ’‘](#example-codiemullins "Examples") | [
Mohammad Rajabifard](https://morajabi.me)
[πŸ“–](https://github.com/paypal/downshift/commits?author=morajabi "Documentation") [πŸ€”](#ideas-morajabi "Ideas, Planning, & Feedback") | [
Frank Tan](https://github.com/tansongyang)
[πŸ’»](https://github.com/paypal/downshift/commits?author=tansongyang "Code") | [
Kier Borromeo](https://kierb.com)
[πŸ’‘](#example-srph "Examples") | | [
Paul Veevers](https://github.com/paul-veevers)
[πŸ’»](https://github.com/paypal/downshift/commits?author=paul-veevers "Code") | [
Ron Cruz](https://github.com/Ronolibert)
[πŸ“–](https://github.com/paypal/downshift/commits?author=Ronolibert "Documentation") | [
Rick McGavin](http://rickmcgavin.github.io)
[πŸ“–](https://github.com/paypal/downshift/commits?author=rickMcGavin "Documentation") | [
Jelle Versele](http://twitter.com/vejersele)
[πŸ’‘](#example-vejersele "Examples") | [
Brent Ertz](https://github.com/brentertz)
[πŸ€”](#ideas-brentertz "Ideas, Planning, & Feedback") | [
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") | [
Mark Ellis](http://mfellis.com)
[πŸ€”](#ideas-ellismarkf "Ideas, Planning, & Feedback") | | [
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") | [
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") | [
Arturo Romero](http://arturoromero.info/)
[πŸ’‘](#example-arturoromeroslc "Examples") | [
Dave Garwacke](http://www.warbyparker.com)
[πŸ“–](https://github.com/paypal/downshift/commits?author=ifyoumakeit "Documentation") | [
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") | [
Luis Merino](https://github.com/Rendez)
[πŸ“–](https://github.com/paypal/downshift/commits?author=Rendez "Documentation") | [
Andrew Hansen](http://twitter.com/arahansen)
[πŸ’»](https://github.com/paypal/downshift/commits?author=arahansen "Code") [⚠️](https://github.com/paypal/downshift/commits?author=arahansen "Tests") | +| [
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 {