diff --git a/scripts/build-svelte-types.js b/scripts/build-svelte-types.js index dbe4cb02..e5b72ba8 100644 --- a/scripts/build-svelte-types.js +++ b/scripts/build-svelte-types.js @@ -72,7 +72,8 @@ const addOnClick = [ 'ActionsButton', ]; -const addOnClickProp = (componentName) => { +const addOnClickProp = (componentName, content) => { + if (content.includes(' onClick?: ')) return ''; if (addOnClick.includes(componentName)) return `\n onClick?: (e: any) => void;\n`; return ''; @@ -98,7 +99,8 @@ const createComponentTypes = (componentName, propsContent) => { .replace( 'interface Props {', `export interface Props {\n class?: string;${addOnClickProp( - componentName + componentName, + propsContent )}` ) .replace(/ClassName/g, 'Class')