Missing types for Link attributes onClick
, onTouchStart
, onMouseEnter
on Next.js 13
#42003
Closed
1 task done
Labels
Verify canary release
Provide environment information
When updating to Next.js 13, I had to move
onClick
,onTouchStart
,onMouseEnter
directly to theLink
component and noticed that the event type in/next/dist/client/link.d.ts
was set toany
What browser are you using? (if relevant)
N/A
How are you deploying your application? (if relevant)
N/A
Describe the Bug
I'm getting an
Unsafe member access .preventDefault on an 'any' value.
when using the current Next.js 13 types.A workaround is to cast the type like this:
onClick={(event: MouseEvent) => {}}
Looking at
next.js/packages/next/client/link.tsx
Line 85 in 191710d
I would do a PR myself but I am not familiar with the process
Expected Behavior
I would expect the following event types:
Link to reproduction
next.js/packages/next/client/link.tsx
Line 85 in 191710d
To Reproduce
Just use
onClick
and then try to use theevent
argument like this:The text was updated successfully, but these errors were encountered: