mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-30 01:47:21 +08:00
@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:
5
types/react-select/index.d.ts
vendored
5
types/react-select/index.d.ts
vendored
@@ -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;
|
||||
|
||||
@@ -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" />;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user