I'm using file-loader, a webpack plugin that converts media imports as their URLs, so in import src from './image.png'
, src
is a string
.
I know I can make typescript understand that by having this in some declaration file:
declare module '*.png' { export default ''; }
declare module '*.jpg' { export default ''; }
declare module '*.jpeg' { export default ''; }
declare module '*.svg' { export default ''; }
declare module '*.gif' { export default ''; }
declare module '*.avif' { export default ''; }
However it's very wordy, and this doesn't work:
declare module '*.{png,jpe?g,svg,gif,avif}' { export default ''; }
Is there a parameter in my tsconfig.json or a CLI option I can use so that TypeScript handles real glob patterns in declaration files?