@@ -5,12 +5,6 @@ import type { Paths } from "../types/paths";
55import type { QueryString } from "../types/query-string" ;
66import { AnyJson } from "../types" ;
77
8- type ForwardRef = < Ref , Props = { } > (
9- render : ( props : Props & React . RefAttributes < Ref > , ref : React . Ref < Ref > ) => JSX . Element
10- ) => ( props : Props & React . RefAttributes < Ref > ) => JSX . Element ;
11-
12- const forwardRefTyped = forwardRef as ForwardRef ;
13-
148const isLeftClick = ( e : React . MouseEvent ) => e . button === 0 ;
159
1610const isMod = ( event : React . MouseEvent ) : boolean => event . metaKey || event . altKey || event . ctrlKey || event . shiftKey ;
@@ -31,11 +25,8 @@ export type LinkProps<Path extends string> = Omit<
3125
3226const httpRegex = / ^ h t t p s ? : \/ \/ / ;
3327
34- export const Link = forwardRefTyped (
35- < TPath extends string > (
36- { href, state, replace = false , onClick, query, paths, ...props } : LinkProps < TPath > ,
37- ref : React . Ref < HTMLAnchorElement >
38- ) => {
28+ export const Link : < TPath extends string > ( props : LinkProps < TPath > , ref : React . MutableRefObject < HTMLAnchorElement > ) => JSX . Element = forwardRef (
29+ < TPath extends string > ( { href, state, replace = false , onClick, query, paths, ...props } : LinkProps < TPath > , ref : any ) => {
3930 const { push, replace : _replace } = useNavigation ( ) ;
4031 const contextHref = useHref ( ) ;
4132 const basename = useBasename ( ) ;
@@ -50,4 +41,4 @@ export const Link = forwardRefTyped(
5041 } ;
5142 return < a { ...props } href = { _href } onClick = { _onClick } ref = { ref } /> ;
5243 }
53- ) as unknown ;
44+ ) as any ;
0 commit comments