Skip to content

Commit

Permalink
Fix TS type conflict for <img> tag (#28672)
Browse files Browse the repository at this point in the history
This type was added in PR #28269 but doesn't need to be public and was causing conflicts with `@types/react@17`.

We currently use `@types/react@16` so ideally we should upgrade to `@types/react@17` and then remove the `ts-ignore`.

Fixes #28647
  • Loading branch information
styfle committed Aug 31, 2021
1 parent f6d8a11 commit acf65f9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 1 addition & 0 deletions packages/next/client/image.tsx
Expand Up @@ -627,6 +627,7 @@ export default function Image({
data-nimg={layout}
style={imgStyle}
className={className}
// @ts-ignore - TODO: upgrade to `@types/react@17`
loading={loading || 'lazy'}
/>
</noscript>
Expand Down
5 changes: 0 additions & 5 deletions packages/next/types/index.d.ts
Expand Up @@ -40,11 +40,6 @@ declare module 'react' {
interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
nonce?: string
}

// <img loading="lazy"> support
interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {
loading?: 'auto' | 'eager' | 'lazy'
}
}

export type Redirect =
Expand Down

0 comments on commit acf65f9

Please sign in to comment.