Typescript image import Typescript image import reactjs reactjs

Typescript image import


One of the ways to get rid of that error is by modifying d.ts file as follows:

declare module "*.png"

remove

{  const value: string;  export default value;}

or alternatively you can do:

declare module "*.png" {  const value: any;  export default value;}

Update

The best solution with type-checking is:

declare module "*.png" {   const value: any;   export = value;}