Skip to content

Commit

Permalink
accordion: fix incorrect onChange type sig (#482)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaance committed Feb 21, 2020
1 parent 40b9e6f commit 68f528d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/accordion/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const Accordion = forwardRef<HTMLDivElement, AccordionProps>(
}

const onSelectPanel = useCallback(
(index: AccordionIndex) => {
(index: number) => {
onChange && onChange(index);

if (!isControlled) {
Expand Down Expand Up @@ -263,7 +263,7 @@ export type AccordionProps = Omit<
*
* @see Docs https://reacttraining.com/reach-ui/accordion#accordion-onchange
*/
onChange?(index?: AccordionIndex): void;
onChange?(index?: number): void;
/**
* Whether or not an uncontrolled accordion is read-only or controllable by a
* user interaction.
Expand Down Expand Up @@ -614,7 +614,7 @@ type ButtonRef = React.MutableRefObject<any>;
type AccordionIndex = number | number[];

interface IAccordionContext {
accordionId: string;
accordionId: string | undefined;
openPanels: AccordionIndex;
onSelectPanel(index: AccordionIndex): void;
readOnly: boolean;
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/accordion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ Whether or not multiple panels in an uncontrolled accordion can be opened at the
##### Accordion `onChange`
`onChange?: (value: number | number[]) => void`
`onChange?: (value: number) => void`
The callback that is fired when an accordion item's open state is changed.

Expand Down

0 comments on commit 68f528d

Please sign in to comment.