I am currently utilizing typescript in conjunction with NextJs and next-images. Here is the code snippet:
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>;;
When no typing is provided, the following error occurs:
Cannot find module './logo.svg'.ts(2307)
Presently, I have the following typings in my typings.ts file:
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;
}
Even though I have these typings defined, the error persists. Has anyone encountered a similar issue? Is there a more efficient way to structure the typings.ts file?