import a from 'a.png?sizes[]=64'
but I get a ts error Cannot find module 'a.png?sizes[]=64'
. All works with webpack, but tsc check types fails because there is no file like that. That should only check for a.png
with query param.
Any ideas how to do that? I run this command to check types tsc --project ./tsconfig.json --noEmit
One hack is to use require()
syntax but that will skip any checks. So even if the file is missing, no error will happen.
Adding additional declaration helped, but there must be a better way.
e.g. types/import-png.d.ts
declare module '*.png' {
const value: string;
export default value;
}
declare module '*.png?inline' {
const value: string;
export default value;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With