DefinitelyTyped/types/react-virtualized-select/index.d.ts
Armando Aguirre 84474b4964
Merge pull request #24079 from Metavirulent/generic_options_for_react-virtualized-select
add generics for Options for react-virtualized-select
2018-03-09 14:56:31 -08:00

37 lines
1.4 KiB
TypeScript

// Type definitions for react-virtualized-select 3.0
// Project: https://github.com/bvaughn/react-virtualized-select
// Definitions by: Sean Kelley <https://github.com/seansfkelley>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import * as React from "react";
import { ReactSelectProps, ReactAsyncSelectProps, LoadOptionsHandler, OptionValues } from "react-select";
import { ListProps } from "react-virtualized";
export interface VirtualizedOptionRenderOptions<T> {
focusedOption: T;
focusedOptionIndex: number;
focusOption(option: T): void;
key: string;
labelKey: keyof T;
listProps: ListProps;
option: T;
options: T[];
selectValue(option: T): void;
style: Record<string, string>;
valueArray: T[];
}
export interface AdditionalVirtualizedSelectProps<TValue> {
maxHeight?: number;
optionHeight?: number;
optionRenderer?(options: VirtualizedOptionRenderOptions<TValue>): JSX.Element;
selectComponent?: React.ComponentClass<any> | React.StatelessComponent<any>;
}
type VirtualizedSelectProps<TValue = OptionValues> = (ReactAsyncSelectProps<TValue> & AdditionalVirtualizedSelectProps<TValue> & { async: true }) |
ReactSelectProps<TValue> & AdditionalVirtualizedSelectProps<TValue>;
declare class VirtualizedSelect<TValue = OptionValues> extends React.PureComponent<VirtualizedSelectProps<TValue>> {}
export default VirtualizedSelect;