Skip to content

Commit 3e9480c

Browse files
committed
Update functionType ternaries to ensure the they are generated correctly
1 parent 2b5d86c commit 3e9480c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/template/javascriptTemplate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import TemplateOptions, { TestLibrary, FunctionType } from './templateOptions';
22

33
const javascriptComponentTemplate = ({ name, functionType }: TemplateOptions) => `import React from 'react';
44
5-
${functionType === FunctionType.Function && `function ${name}({}) {`}
6-
${functionType === FunctionType.Expression && `const ${name} = ({}) => {`}
5+
${functionType === FunctionType.Function ? `function ${name}({}) {` : ''}
6+
${functionType === FunctionType.Expression ? `const ${name} = ({}) => {` : ''}
77
return <>${name}</>
88
};
99

src/template/typescriptTemplate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ const typescriptComponentTemplate = ({ name, functionType }: TemplateOptions) =>
44
55
export interface ${name}Props {}
66
7-
${functionType === FunctionType.Function && `function ${name}({ }: ${name}Props) {`}
8-
${functionType === FunctionType.Expression && `const ${name}: React.FunctionComponent<${name}Props> = ({ }) => {`}
7+
${functionType === FunctionType.Function ? `function ${name}({ }: ${name}Props) {` : ''}
8+
${functionType === FunctionType.Expression ? `const ${name}: React.FunctionComponent<${name}Props> = ({ }) => {` : ''}
99
return <>${name}</>
1010
};
1111

0 commit comments

Comments
 (0)