New global.d.ts
"*.svg" type blocks locally defined definition (for use with SVGR)
#26357
Labels
bug
Issue was opened via the bug report template.
What version of Next.js are you using?
11.0.0
What version of Node.js are you using?
14.16.1
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
I use SVGR to convert svg imports into react components. I define a custom type in
next-env.d.ts
to support this:However, with the upgrade to Next 11, I find the type definition in
next/types/global
blocks my custom definition:Expected Behavior
While I understand the utility—and I'm really excited for the direction Next is headed—my apps all only consume SVG as components. Inlining SVGs allows us to do a lot more with them than if they were squashed in image tags. While I would like the ability to do both for cases where it was warranted, it's most important that my types compile now.
I see this bug as applying to all of the module types defined by next. They're important, but they need to be overridable.
To Reproduce
It's as easy as adding the above type definition to
next-env.d.ts
, then trying to import an svg file into typescript. You'll see the locally defined types are not being used.The text was updated successfully, but these errors were encountered: