mirror of
https://github.com/pheralb/svgl.git
synced 2025-12-29 08:01:36 +08:00
🛠️ Use `import type from SVGProps instead import * from React`
This commit is contained in:
@@ -29,8 +29,8 @@ export const parseReactSvgContent = async ({
|
||||
let structuredCode = "";
|
||||
if (typescript) {
|
||||
structuredCode =
|
||||
`import * as React from 'react';\n\n` +
|
||||
`const ${componentName} = (props: React.SVGProps<SVGSVGElement>) => (\n ${reactifiedSvg}\n);\n\n` +
|
||||
`import type { SVGProps } from "react";\n\n` +
|
||||
`const ${componentName} = (props: SVGProps<SVGSVGElement>) => (\n ${reactifiedSvg}\n);\n\n` +
|
||||
`export { ${componentName} };`;
|
||||
} else {
|
||||
structuredCode = `const ${componentName} = (props) => (\n ${reactifiedSvg}\n);\n\nexport { ${componentName} };`;
|
||||
|
||||
Reference in New Issue
Block a user