mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-19 01:28:38 +02:00
refactor: reduce number of leaked anys (#7465)
This commit is contained in:
parent
6e62bba30f
commit
89b0fff128
39 changed files with 121 additions and 89 deletions
|
@ -196,9 +196,7 @@ function CollapsibleBase({
|
|||
className,
|
||||
disableSSRStyle,
|
||||
}: CollapsibleBaseProps) {
|
||||
// any because TS is a pain for HTML element refs, see https://twitter.com/sebastienlorber/status/1412784677795110914
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const collapsibleRef = useRef<any>(null);
|
||||
const collapsibleRef = useRef<HTMLElement>(null);
|
||||
|
||||
useCollapseAnimation({collapsibleRef, collapsed, animation});
|
||||
|
||||
|
@ -206,7 +204,7 @@ function CollapsibleBase({
|
|||
<As
|
||||
// @ts-expect-error: the "too complicated type" is produced from
|
||||
// "CollapsibleElementType" being a huge union
|
||||
ref={collapsibleRef}
|
||||
ref={collapsibleRef as RefObject<never>} // Refs are contravariant, which is not expressible in TS
|
||||
style={disableSSRStyle ? undefined : getSSRStyle(collapsed)}
|
||||
onTransitionEnd={(e: React.TransitionEvent) => {
|
||||
if (e.propertyName !== 'height') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue