Skip to content

Commit

Permalink
Move type to image component
Browse files Browse the repository at this point in the history
  • Loading branch information
lfades committed Feb 15, 2022
1 parent 00ca8df commit 88fe254
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 7 additions & 0 deletions packages/next/client/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ type OnLoadingComplete = (result: {

type ImgElementStyle = NonNullable<JSX.IntrinsicElements['img']['style']>

export interface StaticImageData {
src: string
height: number
width: number
blurDataURL?: string
}

interface StaticRequire {
default: StaticImageData
}
Expand Down
7 changes: 1 addition & 6 deletions packages/next/image-types/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
// this file is conditionally added/removed to next-env.d.ts
// if the static image import handling is enabled

interface StaticImageData {
src: string
height: number
width: number
blurDataURL?: string
}
import type { StaticImageData } from '../dist/client/image'

declare module '*.png' {
const content: StaticImageData
Expand Down
2 changes: 1 addition & 1 deletion packages/next/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"moduleResolution": "node",
"jsx": "react"
},
"exclude": ["dist", "./*.d.ts"]
"exclude": ["dist", "./*.d.ts", "image-types/global.d.ts"]
}

0 comments on commit 88fe254

Please sign in to comment.