Skip to content

Commit 61eed02

Browse files
author
Simon Planinschek
committed
Fixed "JSX.IntrinsicElements" error and handled className exception
1 parent a40bd58 commit 61eed02

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

generator.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function formatName(string) {
4343
function componentTemplate(name, svg) {
4444
let component = "import React from 'react'\n"
4545
component += "import { IconProps } from './types'\n"
46-
component += `const ${name}: React.FC<IconProps> = (props) => (`
46+
component += `const ${name}: React.FC<IconProps> = (props: IconProps):any => (`
4747
component += svg + ')\n\n'
4848
component += `export { ${name} }`
4949

@@ -101,7 +101,10 @@ async function getSVGFile(icon, version) {
101101
`https://fonts.gstatic.com/s/i/materialicons/${icon}/v${version}/24px.svg`
102102
)
103103

104-
return svg.data.replace('height="24"', '').replace('width="24"', '{...props}')
104+
return svg.data
105+
.replace('height="24"', '')
106+
.replace('width="24"', '{...props}')
107+
.replace(/class/g, 'className')
105108
}
106109

107110
/**

0 commit comments

Comments
 (0)