Skip to content

Commit

Permalink
Fix JSX compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
lhansford committed Aug 17, 2022
1 parent eacad1c commit f9e436c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
8 changes: 8 additions & 0 deletions config/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,12 @@ module.exports = {
preset: 'ts-jest',
rootDir: './../src',
testEnvironment: 'jsdom',
globals: {
'ts-jest': {
// ts-jest configuration goes here
tsconfig: {
jsx: 'react',
},
},
},
};
2 changes: 1 addition & 1 deletion dist/index.d.ts.map
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"mappings":";AAEA;IACE,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,QAAA,MAAM,QAAQ,0CAA0D,MAAM,KAAG,WAyBhF,CAAC;AAEF,eAAe,QAAQ,CAAC","sources":["src/src/index.tsx","src/index.tsx"],"sourcesContent":[null,"import React from 'react';\n\ninterface IProps {\n children?: React.ReactNode;\n conjuction?: string;\n oxfordComma?: boolean;\n}\n\nconst ReactAnd = ({ children, conjuction = 'and', oxfordComma = true }: IProps): JSX.Element => {\n if (!children) {\n return <></>;\n }\n if (!Array.isArray(children) || children.length === 1) {\n return <>{children}</>;\n }\n if (children.length === 2) {\n return <>{[children[children.length - 2], ` ${conjuction} `, children[children.length - 1]]}</>;\n }\n const commaSeparatedItems = children\n .slice(0, children.length - 2)\n .reduce((previous: React.ReactNode[], current) => {\n return [...previous, current, ', '];\n }, []);\n return (\n <>\n {[\n ...commaSeparatedItems,\n children[children.length - 2],\n oxfordComma ? `, ${conjuction} ` : ` ${conjuction} `,\n children[children.length - 1],\n ]}\n </>\n );\n};\n\nexport default ReactAnd;\n"],"names":[],"version":3,"file":"index.d.ts.map","sourceRoot":"../"}
{"mappings":";AAEA;IACE,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,QAAA,MAAM,QAAQ,0CAA0D,MAAM,KAAG,WAyBhF,CAAC;AAEF,eAAe,QAAQ,CAAC","sources":["src/src/index.tsx","src/index.tsx"],"sourcesContent":[null,"import React from 'react';\n\ninterface IProps {\n children?: React.ReactNode;\n conjuction?: string;\n oxfordComma?: boolean;\n}\n\nconst ReactAnd = ({ children, conjuction = 'and', oxfordComma = true }: IProps): JSX.Element => {\n if (!children) {\n return <></>;\n }\n if (!Array.isArray(children) || children.length === 1) {\n return <>{children}</>;\n }\n if (children.length === 2) {\n return <>{[children[children.length - 2], ` ${conjuction} `, children[children.length - 1]]}</>;\n }\n const commaSeparatedItems = children\n .slice(0, children.length - 2)\n .reduce((previous: React.ReactNode[], current) => {\n return [...previous, current, ', '];\n }, []);\n return (\n <>\n {[\n ...commaSeparatedItems,\n children[children.length - 2],\n oxfordComma ? `, ${conjuction} ` : ` ${conjuction} `,\n children[children.length - 1],\n ]}\n </>\n );\n};\n\nexport default ReactAnd;\n"],"names":[],"version":3,"file":"index.d.ts.map"}
16 changes: 8 additions & 8 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-and",
"version": "1.0.1",
"version": "1.0.2",
"description": "A lightweight React component for joining multiple components in a grammatically correct way.",
"keywords": [
"react",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"isolatedModules": true,
"noEmit": true,
"outDir": "dist",
"jsx": "react",
"jsx": "preserve",
"declaration": true,
"lib": [
"dom",
Expand Down

0 comments on commit f9e436c

Please sign in to comment.