Skip to content

Commit

Permalink
FIX (types): make options and values type generic closes #48 thanks to
Browse files Browse the repository at this point in the history
…@lopesc

* FIX (types): make options and values type generic

* FIX: add default type to ISelectProps
  • Loading branch information
lopesc authored and sanusart committed Nov 13, 2019
1 parent f3f6807 commit 00b8ddd
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,34 @@ export interface IMethods {
safeString: () => void;
}

export interface IRenderer {
props?: ISelectProps;
export interface IRenderer<T extends object = object> {
props?: ISelectProps<T>;
state?: IState;
methods?: IMethods;
}

export interface IKeyDown {
export interface IKeyDown<T extends object = object> {
event: Event;
props?: ISelectProps;
props?: ISelectProps<T>;
state?: IState;
methods?: IMethods;
setState?: () => void;
}

export interface IItemRenderer<T> {
export interface IItemRenderer<T extends object = object> {
item?: T;
itemIndex?: number;
props?: ISelectProps;
props?: ISelectProps<T>;
state?: IState;
methods?: IMethods;
}

export interface ISelectProps {
export interface ISelectProps<T extends object = object> {
className?: string;
addPlaceholder?: string;
placeholder?: string;
values: object[];
options: object[];
values: T[];
options: T[];
multi?: boolean;
disabled?: boolean;
searchBy?: string;
Expand Down Expand Up @@ -92,21 +92,21 @@ export interface ISelectProps {
onClearAll?: () => void;
onSelectAll?: () => void;
onCreateNew?: () => void;
searchFn?: ({ props, state, methods }: IRenderer) => object[];
handleKeyDownFn?: ({ event, props, state, methods, setState }: IKeyDown) => void;
clearRenderer?: ({ props, state, methods }: IRenderer) => void;
contentRenderer?: ({ props, state, methods }: IRenderer) => void;
dropdownRenderer?: ({ props, state, methods }: IRenderer) => void;
dropdownHandleRenderer?: ({ props, state, methods }: IRenderer) => void;
inputRenderer?: ({ props, state, methods }: IRenderer) => void;
itemRenderer?: ({ item, itemIndex, props, state, methods }: IItemRenderer) => void;
loadingRenderer?: ({ props }: IItemRenderer) => void;
noDataRenderer?: ({ props, state, methods }: IRenderer) => void;
optionRenderer?: ({ item, props, state, methods }: IItemRenderer) => void;
separatorRenderer?: ({ props, state, methods }: IRenderer) => void;
additionalProps?: object;
searchFn?: ({ props, state, methods }: IRenderer<T>) => T[];
handleKeyDownFn?: ({ event, props, state, methods, setState }: IKeyDown<T>) => void;
clearRenderer?: ({ props, state, methods }: IRenderer<T>) => void;
contentRenderer?: ({ props, state, methods }: IRenderer<T>) => void;
dropdownRenderer?: ({ props, state, methods }: IRenderer<T>) => void;
dropdownHandleRenderer?: ({ props, state, methods }: IRenderer<T>) => void;
inputRenderer?: ({ props, state, methods }: IRenderer<T>) => void;
itemRenderer?: ({ item, itemIndex, props, state, methods }: IItemRenderer<T>) => void;
loadingRenderer?: ({ props }: IItemRenderer<T>) => void;
noDataRenderer?: ({ props, state, methods }: IRenderer<T>) => void;
optionRenderer?: ({ item, props, state, methods }: IItemRenderer<T>) => void;
separatorRenderer?: ({ props, state, methods }: IRenderer<T>) => void;
additionalProps?: T;
}

declare const Select: React.SFC<ISelectProps>;
declare const Select: React.SFC<ISelectProps<T extends object ? T : {}>>;

export default Select;

0 comments on commit 00b8ddd

Please sign in to comment.