Open hellhorse123 opened 6 months ago
Yeah also if I want to do style={{}} or width={} height={}, will not work is there a way to fix this?
You need to tweak this type definition file to keep consistent with the include
option. For example, change this line
to declare module "*.svg"
.
But I'm not sure if it would confilict with the Vite build-in types.
Any updates on this issue? I'm facing the same problem
Creating global.d.ts file and placing it in src folder helped me with resolve this issue
declare module "*.svg" {
import type * as React from "react";
const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>;
export default ReactComponent;
}
Creating global.d.ts file and placing it in src folder helped me with resolve this issue
declare module "*.svg" { import type * as React from "react"; const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>; export default ReactComponent; }
Yes, this way helps me
That way worked for me too, but the key thing was that I had to put it before the line:
/// <reference types="vite/client" />
If I put it after that declaration, it didn't work.
In my React TS project with vite and
"vite-plugin-svgr": "^4.2.0"
I start getting error:when I trying to add className to svg:
My vite.config.ts :