TypeScript - Module '"*.svg"' has no exported member 'ReactComponent

You're naming the custom types as custom.ts.d and it should call custom.d.ts once the ts compiler is configured to process ts|tsx extensions.

After that, you should be able to reference it into your tsconfig.json include section just like this:

"include": ["custom.d.ts"]

You have export default content; But you are doing a named import (not a default import).

Fix

Change declaration to export the name you are importing:

declare module '*.svg' {
  import React = require('react');
  export const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>;
  const src: string;
  export default src;
}

Additional

Recommend not using files in tsconfig.json. Instead just use include


2019 In addition to @basarat's answer: React.SFC is depracated now consider using React.FunctionComponent like:

declare module '*.svg' {
    import React = require('react');
    export const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
    const src: string;
    export default src;
}