mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Allow RefObject<T> 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: `<a ref={ref || innerRef} ...` See: https://github.com/reach/router/blob/master/src/index.js#L392-L405 HTMLAnchorElement's "ref" is defined as Ref<HTMLAnchorElement>.
This commit is contained in:
Vendored
+1
-1
@@ -59,7 +59,7 @@ export interface LinkProps<TState> extends AnchorProps {
|
||||
getProps?: (props: LinkGetProps) => {};
|
||||
state?: TState;
|
||||
/** @deprecated If using React >= 16.4, use ref instead. */
|
||||
innerRef?: React.RefCallback<HTMLAnchorElement>;
|
||||
innerRef?: React.Ref<HTMLAnchorElement>;
|
||||
}
|
||||
|
||||
export interface LinkGetProps {
|
||||
|
||||
@@ -59,3 +59,6 @@ const handleRef = (el: HTMLAnchorElement) => {
|
||||
};
|
||||
|
||||
render(<Link innerRef={handleRef} to="./foo"></Link>, document.getElementById('app-root'));
|
||||
|
||||
const refObject: React.RefObject<HTMLAnchorElement> = { current: null };
|
||||
render(<Link innerRef={refObject} to="./foo"></Link>, document.getElementById('app-root'));
|
||||
|
||||
Reference in New Issue
Block a user