@types/react-select: missing parameter 'index' to ValueRendererHandler (#27265)

* @types/react-select: added missing parameter 'index' to ValueRendererHandler

* @types/react-select: increment version
This commit is contained in:
RCGuillaume
2018-07-23 13:19:24 -04:00
committed by Andy
parent 2fa8371b3c
commit f73ffb216e
2 changed files with 12 additions and 2 deletions

View File

@@ -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 <https://github.com/Hesquibet>
// Gilad Gray <https://github.com/giladgray>
@@ -13,6 +13,7 @@
// David Schkalee <https://github.com/misantronic>
// Arthur Udalov <https://github.com/darkartur>
// Sebastian Silbermann <https://github.com/eps1lon>
// Guillaume Chartier <https://github.com/RCGuillaume>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -49,7 +50,7 @@ export type OnOpenHandler = () => void;
export type OnFocusHandler = React.FocusEventHandler<HTMLDivElement | HTMLInputElement>;
export type OnBlurHandler = React.FocusEventHandler<HTMLDivElement | HTMLInputElement>;
export type OptionRendererHandler<TValue = OptionValues> = (option: Option<TValue>) => HandlerRendererResult;
export type ValueRendererHandler<TValue = OptionValues> = (option: Option<TValue>) => HandlerRendererResult;
export type ValueRendererHandler<TValue = OptionValues> = (option: Option<TValue>, index?: number) => HandlerRendererResult;
export type OnValueClickHandler<TValue = OptionValues> = (option: Option<TValue>, event: React.MouseEvent<HTMLAnchorElement>) => void;
export type IsOptionUniqueHandler<TValue = OptionValues> = (arg: { option: Option<TValue>, options: Options<TValue>, labelKey: string, valueKey: string }) => boolean;
export type IsValidNewOptionHandler = (arg: { label: string }) => boolean;

View File

@@ -430,6 +430,15 @@ describe("Examples", () => {
/>;
});
it("Value render with custom value option and index", () => {
const valueRenderer = (option: ReactSelectModule.Option<CustomValueType>, index: number): ReactSelectModule.HandlerRendererResult =>
null;
<CustomValueReactSelect
valueRenderer={valueRenderer}
/>;
});
it("No Results renderer with string", () => {
<ReactSelect noResultsText="no results" />;
});