Skip to content

Commit

Permalink
fix(TS): improved typings for getMenuProps (#534)
Browse files Browse the repository at this point in the history
* Improved typings for getMenuProps

Fixes the typing part of #490

* Update index.d.ts

* Fixed build error

* Update index.d.ts
  • Loading branch information
franklixuefei authored and Kent C. Dodds committed Aug 20, 2018
1 parent 022e986 commit 0ff43a3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,29 @@ export interface GetInputPropsOptions
export interface GetLabelPropsOptions
extends React.HTMLProps<HTMLLabelElement> {}

export interface getToggleButtonPropsOptions
export interface GetToggleButtonPropsOptions
extends React.HTMLProps<HTMLButtonElement> {}

interface OptionalExtraGetItemPropsOptions {
[key: string]: any
export interface GetMenuPropsOptions {
refKey?: string;
['aria-label']?: string;
};

export interface GetMenuPropsOtherOptions {
suppressRefError?: boolean;
}

export interface GetItemPropsOptions<Item>
extends OptionalExtraGetItemPropsOptions {
extends Record<string, any> {
index?: number
item: Item
}

export interface PropGetters<Item> {
getRootProps: (options: GetRootPropsOptions) => any
getToggleButtonProps: (options?: getToggleButtonPropsOptions) => any
getToggleButtonProps: (options?: GetToggleButtonPropsOptions) => any
getLabelProps: (options?: GetLabelPropsOptions) => any
getMenuProps: (options?: {}) => any
getMenuProps: (options?: GetMenuPropsOptions, otherOptions?: GetMenuPropsOtherOptions) => any
getInputProps: (options?: GetInputPropsOptions) => any
getItemProps: (options: GetItemPropsOptions<Item>) => any
}
Expand Down

0 comments on commit 0ff43a3

Please sign in to comment.