Skip to content

Commit

Permalink
fix(types): fix various types (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyletsang authored May 24, 2021
1 parent 344a52d commit 2bc0639
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Anchor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const propTypes = {
onKeyDown: PropTypes.func,
disabled: PropTypes.bool,
role: PropTypes.string,
tabIndex: PropTypes.oneOfType([PropTypes.number]),
tabIndex: PropTypes.number,
};

function isTrivialHref(href?: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface UseButtonPropsOptions {
type?: ButtonType;
href?: string;
disabled?: boolean;
target?: any;
target?: string;
rel?: string;
onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
tabIndex?: number;
Expand Down
3 changes: 0 additions & 3 deletions src/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ const propTypes = {
/** @private */
onKeyDown: PropTypes.func,
/** @private */
parentOnSelect: PropTypes.func,
/** @private */
activeKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
};

Expand All @@ -40,7 +38,6 @@ export interface NavProps
activeKey?: EventKey;
as?: React.ElementType;
onSelect?: SelectCallback;
parentOnSelect?: SelectCallback;
}

const EVENT_KEY_ATTR = dataAttr('event-key');
Expand Down
13 changes: 8 additions & 5 deletions src/NavItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@ import useEventCallback from '@restart/hooks/useEventCallback';

import NavContext from './NavContext';
import SelectableContext, { makeEventKey } from './SelectableContext';
import { EventKey, DynamicRefForwardingComponent } from './types';
import {
EventKey,
DynamicRefForwardingComponent,
SelectCallback,
} from './types';
import Button from './Button';
import { dataAttr } from './DataKey';

export interface NavItemProps
extends Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
active?: boolean;
as: React.ElementType;
as?: React.ElementType;
disabled?: boolean;
eventKey?: EventKey;
href?: string;
tabIndex?: number;
onSelect?: (navKey: string, e: any) => void;
onSelect?: SelectCallback;
}

const propTypes = {
Expand All @@ -26,9 +30,8 @@ const propTypes = {
role: PropTypes.string,

href: PropTypes.string,
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
tabIndex: PropTypes.number,
eventKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
onclick: PropTypes.func,

as: PropTypes.any,
onClick: PropTypes.func,
Expand Down

0 comments on commit 2bc0639

Please sign in to comment.