From cb3d627af83bf24964b972f4e07ba30797b30c11 Mon Sep 17 00:00:00 2001 From: Eyas Date: Wed, 1 Apr 2020 12:45:29 -0400 Subject: [PATCH] Allow RefObject in reach__router innerRef. (#43534) While https://reach.tech/router/api/Link describes innerRef as a func, it is actually passed to React's HTMLAnchorElement's "ref" prop as such: `. --- types/reach__router/index.d.ts | 2 +- types/reach__router/reach__router-tests.tsx | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/reach__router/index.d.ts b/types/reach__router/index.d.ts index ddcfbcc652..00554e74f9 100644 --- a/types/reach__router/index.d.ts +++ b/types/reach__router/index.d.ts @@ -59,7 +59,7 @@ export interface LinkProps extends AnchorProps { getProps?: (props: LinkGetProps) => {}; state?: TState; /** @deprecated If using React >= 16.4, use ref instead. */ - innerRef?: React.RefCallback; + innerRef?: React.Ref; } export interface LinkGetProps { diff --git a/types/reach__router/reach__router-tests.tsx b/types/reach__router/reach__router-tests.tsx index 90cf7a20b6..fe903f4f71 100644 --- a/types/reach__router/reach__router-tests.tsx +++ b/types/reach__router/reach__router-tests.tsx @@ -59,3 +59,6 @@ const handleRef = (el: HTMLAnchorElement) => { }; render(, document.getElementById('app-root')); + +const refObject: React.RefObject = { current: null }; +render(, document.getElementById('app-root'));