Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved typings for getMenuProps #534

Merged
merged 4 commits into from
Aug 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,29 @@ export interface GetInputPropsOptions
export interface GetLabelPropsOptions
extends React.HTMLProps<HTMLLabelElement> {}

export interface getToggleButtonPropsOptions
export interface GetToggleButtonPropsOptions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing this PR! I've made changes as necessary and please take a look 😄

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