#1012·svgr

Type declaration for `*.svg?url` in Next.js

Author: y-hsgwCreated Sep 9, 2025Updated Sep 24, 2025

Questions and Help

https://github.com/gregberge/svgr/blob/687dd2dd842919ac4a1168eaeaa5bd8dec943404/website/pages/docs/next.mdx?plain=1#L104-L107

Would it be possible to declare this more strictly, for example using StaticImageData (or string | StaticImageData) instead of any?

typescript
declare module '*.svg?url' {
  import { type StaticImageData } from 'next/image'
  const content: string | StaticImageData
  export default content
}

I’d like to understand whether any is intentional, or if it would be acceptable to recommend a stricter type definition in the documentation.