Files
LifeTrinket/template.js
Viktor Rådberg 58fb63eef1 Chore/packages cleanup (#51)
* remove unused

* upgrade packages and use pnpm instead of bun

* unauthenticated github request

* fix eslint

* eslint
2025-11-17 22:25:21 +01:00

39 lines
724 B
JavaScript

const propTypesTemplate = (
{ interfaces, componentName, props, jsx },
{ tpl }
) => {
const title = componentName.split('Svg')[1];
interfaces[0].body.body.push({
type: 'TSPropertySignature',
key: { type: 'Identifier', name: 'size' },
typeAnnotation: {
type: 'TSTypeAnnotation',
typeAnnotation: {
type: 'TSStringKeyword',
},
},
initializer: null,
optional: true,
});
return tpl`
import PropTypes from 'prop-types';
import { SVGProps } from "react";
${interfaces}
const ${title} = (${props}) => {
return ${jsx};
}
${title}.propTypes = {
title: PropTypes.string,
};
export default ${title}`;
};
module.exports = propTypesTemplate;