@@ -40,6 +40,10 @@ export const generateComponent = (data: XmlData, config: Config) => {
4040 svgComponents . add ( 'Svg' ) ;
4141 }
4242
43+ if ( config . use_typescript ) {
44+ svgComponents . add ( 'GProps' ) ;
45+ }
46+
4347 mkdirp . sync ( saveDir ) ;
4448 glob . sync ( path . join ( saveDir , '*' ) ) . forEach ( ( file ) => fs . unlinkSync ( file ) ) ;
4549
@@ -54,6 +58,10 @@ export const generateComponent = (data: XmlData, config: Config) => {
5458
5559 names . push ( iconIdAfterTrim ) ;
5660
61+ if ( config . use_typescript ) {
62+ currentSvgComponents . add ( 'GProps' ) ;
63+ }
64+
5765 for ( const domName of Object . keys ( item ) ) {
5866 switch ( domName ) {
5967 case 'path' :
@@ -77,7 +85,7 @@ export const generateComponent = (data: XmlData, config: Config) => {
7785 }
7886
7987 imports . push ( componentName ) ;
80- cases += `${ whitespace ( 6 ) } return <${ componentName } size={size} color={color} />;\n` ;
88+ cases += `${ whitespace ( 6 ) } return <${ componentName } size={size} color={color} {...rest} />;\n` ;
8189
8290 singleFile = getTemplate ( 'SingleIcon' + extension ) ;
8391 singleFile = replaceSize ( singleFile , config . default_icon_size ) ;
@@ -128,7 +136,7 @@ export const generateComponent = (data: XmlData, config: Config) => {
128136} ;
129137
130138const generateCase = ( data : XmlData [ 'svg' ] [ 'symbol' ] [ number ] , baseIdent : number ) => {
131- let template = `\n${ whitespace ( baseIdent ) } <Svg viewBox="${ data . $ . viewBox } " width={size} height={size}>\n` ;
139+ let template = `\n${ whitespace ( baseIdent ) } <Svg viewBox="${ data . $ . viewBox } " width={size} height={size} {...rest} >\n` ;
132140
133141 for ( const domName of Object . keys ( data ) ) {
134142 let realDomName = SVG_MAP [ domName ] ;
0 commit comments