I found an answer myself. I created the following wrapper function around the SVG component and styled this component rather than the SVG itself:
import SVG from 'react-inlinesvg';
import { ComponentProps } from 'react';
function StaticSrcSVG(src: string) {
return Object.assign(
(props: Omit<ComponentProps<typeof SVG>, 'src'>) => <SVG src={src} {...props} />,
{
displayName: `${src}(StaticSrcSVG)`
}
);
}