Context
In web/src/pages/Cases/CaseDetails/Voting/VotesDetails/index.tsx, the CustomAccordion component from @kleros/ui-components-library declares two AccordionItem types. TypeScript resolves to the narrower type, causing type errors when passing accordionItems directly to StyledAccordion.
As a workaround, the following cast was introduced:
<StyledAccordion items={accordionItems as unknown as CustomAccordionItem[]} />
The CustomAccordionItem type alias was also added with an explanatory comment:
//Current ui-components-library version declares two AccordionItem types.
//TypeScript resolves to the narrower type, so we get type errors here.
//Updating to the latest version of the library should allows to simplify this.
type CustomAccordionItem = React.ComponentProps<typeof CustomAccordion>["items"][number];
Action Required
Once @kleros/ui-components-library is updated:
- Check if the duplicate
AccordionItem type issue has been resolved.
- If resolved, simplify the type cast — remove the
CustomAccordionItem alias and pass accordionItems directly.
- If the issue is still not resolved after the library update, it must be fixed in the library itself as soon as possible.
References
Context
In
web/src/pages/Cases/CaseDetails/Voting/VotesDetails/index.tsx, theCustomAccordioncomponent from@kleros/ui-components-librarydeclares twoAccordionItemtypes. TypeScript resolves to the narrower type, causing type errors when passingaccordionItemsdirectly toStyledAccordion.As a workaround, the following cast was introduced:
The
CustomAccordionItemtype alias was also added with an explanatory comment:Action Required
Once
@kleros/ui-components-libraryis updated:AccordionItemtype issue has been resolved.CustomAccordionItemalias and passaccordionItemsdirectly.References