diff --git a/.gitignore b/.gitignore index 797df82cdac..93e8fb31ac9 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ node_modules/ examples/test .idea/ .vscode/ -TODO.md \ No newline at end of file +TODO.md +tsconfig.tsbuildinfo \ No newline at end of file diff --git a/package.json b/package.json index 52f85d18838..75bc0640290 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "scripts": { "bootstrap": "lerna bootstrap", "clean": "lerna clean", - "build": "node ./scripts/build.js", + "build": "node ./scripts/build.js && npm run build:ts", + "build:ts": "tsc -b packages/react packages/core packages/antd packages/validator packages/utils packages/types", "build:docs": "node ./scripts/docs.js build -i docs -o docs", "start": "node ./scripts/docs.js start -i docs", "sort-api": "node ./scripts/sort-api-table.js", @@ -124,4 +125,4 @@ "type": "opencollective", "url": "https://opencollective.com/uform" } -} +} \ No newline at end of file diff --git a/packages/antd/src/fields/cards.tsx b/packages/antd/src/fields/cards.tsx index 1c072a69029..a48422b0f22 100644 --- a/packages/antd/src/fields/cards.tsx +++ b/packages/antd/src/fields/cards.tsx @@ -1,4 +1,4 @@ -import React, { Fragment } from 'react' +import React, { Fragment, ReactElement } from 'react' import styled from 'styled-components' import { registerFormField } from '@uform/react' import { Card } from 'antd' @@ -18,14 +18,14 @@ const FormCardsField = styled( ) } - public renderEmpty = title => { + public renderCardEmpty = (title: string | ReactElement) => { return ( - {super.renderEmpty()} + {this.renderEmpty()} ) } @@ -68,7 +68,7 @@ const FormCardsField = styled( ) })} - {value.length === 0 && this.renderEmpty(title)} + {value.length === 0 && this.renderCardEmpty(title)}
{value.length > 0 && this.renderAddition()}
diff --git a/packages/antd/tsconfig.json b/packages/antd/tsconfig.json new file mode 100644 index 00000000000..c4ef07ef07c --- /dev/null +++ b/packages/antd/tsconfig.json @@ -0,0 +1,24 @@ +{ + "extends": "../tsconfig.settings.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "lib" + }, + "references": [ + { + "path": "../react" + }, + { + "path": "../core" + }, + { + "path": "../utils" + }, + { + "path": "../validator" + }, + { + "path": "../types" + } + ] +} \ No newline at end of file diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json new file mode 100644 index 00000000000..82f94f51d26 --- /dev/null +++ b/packages/core/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../tsconfig.settings.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "lib" + }, + "references": [ + { + "path": "../utils" + }, + { + "path": "../validator" + }, + { + "path": "../types" + } + ] +} \ No newline at end of file diff --git a/packages/react/tsconfig.json b/packages/react/tsconfig.json new file mode 100644 index 00000000000..1e6b5809f21 --- /dev/null +++ b/packages/react/tsconfig.json @@ -0,0 +1,21 @@ +{ + "extends": "../tsconfig.settings.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "lib" + }, + "references": [ + { + "path": "../core" + }, + { + "path": "../utils" + }, + { + "path": "../validator" + }, + { + "path": "../types" + } + ] +} \ No newline at end of file diff --git a/packages/tsconfig.json b/packages/tsconfig.json new file mode 100644 index 00000000000..5302b7ade1c --- /dev/null +++ b/packages/tsconfig.json @@ -0,0 +1,23 @@ +{ + "files": [], + "references": [ + { + "path": "antd" + }, + { + "path": "react" + }, + { + "path": "core" + }, + { + "path": "utils" + }, + { + "path": "validator" + }, + { + "path": "types" + } + ] +} \ No newline at end of file diff --git a/packages/tsconfig.settings.json b/packages/tsconfig.settings.json new file mode 100644 index 00000000000..6bf072c6622 --- /dev/null +++ b/packages/tsconfig.settings.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig", +} \ No newline at end of file diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json new file mode 100644 index 00000000000..62b12ad8f98 --- /dev/null +++ b/packages/types/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.settings.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "lib" + }, + "references": [] +} \ No newline at end of file diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json new file mode 100644 index 00000000000..62b12ad8f98 --- /dev/null +++ b/packages/utils/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.settings.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "lib" + }, + "references": [] +} \ No newline at end of file diff --git a/packages/validator/tsconfig.json b/packages/validator/tsconfig.json new file mode 100644 index 00000000000..acffdd0e41a --- /dev/null +++ b/packages/validator/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../tsconfig.settings.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "lib" + }, + "references": [ + { + "path": "../utils" + } + ] +} \ No newline at end of file diff --git a/scripts/build.js b/scripts/build.js index 51272f59fc3..ef16d708217 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -65,7 +65,23 @@ const complieJSPackages = async callback => { } const transformFilesAsync = async (fileNames, options) => { - let program = ts.createProgram(fileNames, options.compilerOptions) + let program = ts.createProgram(fileNames, { + "esModuleInterop": true, + "jsx": "react", + "module": "commonjs", + "target": "ES5", + "allowJs": false, + "noUnusedLocals": true, + "removeComments": true, + "preserveConstEnums": true, + "sourceMap": false, + "declaration": true, + "outDir": "../lib", + "baseUrl": ".", + "paths": { + "rxjs/*": ["./node_modules/rxjs/*"] + } + }) let emitResult = program.emit() let allDiagnostics = ts @@ -117,5 +133,5 @@ const complieTSPackages = async callback => { }) } -complieTSPackages() +//complieTSPackages() complieJSPackages() diff --git a/tsconfig.json b/tsconfig.json index 53649cefafc..0b174a4c168 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,13 +4,14 @@ "esModuleInterop": true, "jsx": "react", "module": "commonjs", - "target": "es6", + "target": "ES5", "allowJs": false, "noUnusedLocals": true, "removeComments": true, "preserveConstEnums": true, "sourceMap": false, "declaration": true, + "composite": true, "outDir": "../lib", "baseUrl": ".", "paths": {