Im using typescript with NextJs and next-images. The Code is:
import css from "./style.sass";
import img from './logo.svg';
import Link from 'next/link';
export default () => <Link href="/">
<img src={img} className={css.logo}/>
</Link>;
If no typing is given this error is shown:
Cannot find module './logo.svg'.ts(2307)
Currently i use following typings (typings.ts):
declare module "*.svg" {
const value: string;
export default value;
}
declare module "*.png" {
const value: string;
export default value;
}
declare module "*.jpg" {
const value: string;
export default value;
}
With these typings.ts file the error should be resolved, but it is not. Does anybody had the same error when using it? And is there a better way to write the typings.ts file ?