[TypeScript / Next.js Example] Link component not compatible with latest alpha
See original GitHub issueUsing TS 4.x, Material UI latest alpha and next.js latest I am getting the following error in the Link.tsx component
if (naked) {
return (
<NextComposed
className={className}
ref={innerRef}
href={href}
{...other}
/>
)
}
the error comes when assigning the innerRef to the ref prop of the NextComposed component
Type '((instance: HTMLSpanElement | null) => void) | RefObject<HTMLSpanElement> | (((instance: HTMLAnchorElement | null) => void) & ((instance: any) => void)) | ... 4 more ... | undefined' is not assignable to type '((instance: HTMLAnchorElement | null) => void) | RefObject<HTMLAnchorElement> | null | undefined'.
Type 'RefObject<HTMLSpanElement>' is not assignable to type '((instance: HTMLAnchorElement | null) => void) | RefObject<HTMLAnchorElement> | null | undefined'.
Type 'RefObject<HTMLSpanElement>' is not assignable to type 'RefObject<HTMLAnchorElement>'.
Type 'HTMLSpanElement' is missing the following properties from type 'HTMLAnchorElement': charset, coords, download, hreflang, and 21 more.
I’ve only been working with TS for a few weeks now so not able to figure out the correct typings required here.
Any help would be appreciated
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:18 (13 by maintainers)
Top Results From Across the Web
[TypeScript / Next.js Example] Link component not ...
Using TS 4.x, Material UI latest alpha and next.js latest I am getting the following error in the Link.tsx component if (naked) {...
Read more >Blog - Next.js 13
Next.js 13 introduces layouts, React Server Components, and streaming in the app ... During the alpha, many features are not yet supported.
Read more >Basic Features: TypeScript | Next.js
Next.js supports TypeScript by default and has built-in types for pages and the API. You can get started with TypeScript in Next.js here....
Read more >Advanced Features: Turbopack
Turbopack (alpha) Turbopack is an incremental bundler optimized for JavaScript and TypeScript, written in Rust, and built into Next. js 13. On large ......
Read more >Blog - Next.js 13.1
TypeScript Plugin: We've built a new TypeScript plugin that provides suggestions for page and layout configuration options, brings documentation ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @oliviertassinari you are right, it does fix it… feeling so dumb now 🤪 I’ll be happy to push a PR for that 🙂
+1 based on the feedback to #22452.
Repro is here: https://codesandbox.io/s/infallible-forest-65g4d?file=/src/Link.tsx
Opening a terminal window and running
npx tsc --noEmit
will spit out the error.