From f73ffb216e4534f204197bbd19c009b9ace97cc8 Mon Sep 17 00:00:00 2001 From: RCGuillaume Date: Mon, 23 Jul 2018 13:19:24 -0400 Subject: [PATCH] @types/react-select: missing parameter 'index' to ValueRendererHandler (#27265) * @types/react-select: added missing parameter 'index' to ValueRendererHandler * @types/react-select: increment version --- types/react-select/index.d.ts | 5 +++-- types/react-select/react-select-tests.tsx | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/types/react-select/index.d.ts b/types/react-select/index.d.ts index ed8326c26b..bde3c3c6a0 100644 --- a/types/react-select/index.d.ts +++ b/types/react-select/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-select 1.2 +// Type definitions for react-select 1.3 // Project: https://github.com/JedWatson/react-select // Definitions by: ESQUIBET Hugo // Gilad Gray @@ -13,6 +13,7 @@ // David Schkalee // Arthur Udalov // Sebastian Silbermann +// Guillaume Chartier // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -49,7 +50,7 @@ export type OnOpenHandler = () => void; export type OnFocusHandler = React.FocusEventHandler; export type OnBlurHandler = React.FocusEventHandler; export type OptionRendererHandler = (option: Option) => HandlerRendererResult; -export type ValueRendererHandler = (option: Option) => HandlerRendererResult; +export type ValueRendererHandler = (option: Option, index?: number) => HandlerRendererResult; export type OnValueClickHandler = (option: Option, event: React.MouseEvent) => void; export type IsOptionUniqueHandler = (arg: { option: Option, options: Options, labelKey: string, valueKey: string }) => boolean; export type IsValidNewOptionHandler = (arg: { label: string }) => boolean; diff --git a/types/react-select/react-select-tests.tsx b/types/react-select/react-select-tests.tsx index a6b450f513..7afe6d0023 100644 --- a/types/react-select/react-select-tests.tsx +++ b/types/react-select/react-select-tests.tsx @@ -430,6 +430,15 @@ describe("Examples", () => { />; }); + it("Value render with custom value option and index", () => { + const valueRenderer = (option: ReactSelectModule.Option, index: number): ReactSelectModule.HandlerRendererResult => + null; + + ; + }); + it("No Results renderer with string", () => { ; });