Skip to content

Commit 21176ad

Browse files
committed
feat(renderer): added .d.ts definitions
1 parent d59f2f0 commit 21176ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+704
-44
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"codecov": "codecov",
1818
"start-demo": "lerna run start --scope=@data-driven-forms/react-render-demo",
1919
"lint": "yarn eslint .",
20+
"lint:ts": "tslint -c ./tslint.json 'packages/**/*.d.ts'",
2021
"generate-template": "node ./scripts/generate-mapper.js"
2122
},
2223
"workspaces": [
@@ -53,6 +54,7 @@
5354
"@typescript-eslint/eslint-plugin": "^3.0.0",
5455
"atob-lite": "^2.0.0",
5556
"babel-plugin-transform-imports": "^2.0.0",
57+
"dtslint": "^3.6.4",
5658
"eslint": "^6.8.0",
5759
"eslint-config-i-am-meticulous": "^12.0.0",
5860
"eslint-config-prettier": "^6.10.0",
@@ -77,6 +79,8 @@
7779
"strip-ansi": "^6.0.0",
7880
"terser-webpack-plugin": "^1.3.0",
7981
"ts-loader": "^7.0.5",
82+
"tslint": "^6.1.2",
83+
"tslint-config-prettier": "^1.18.0",
8084
"typescript": "^3.9.3"
8185
},
8286
"release": {

packages/common/tsconfig.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
{
22
"compilerOptions": {
33
"sourceMap": true,
4-
"noImplicitAny": true,
5-
"module": "ES6",
4+
"module": "esnext",
5+
"moduleResolution": "node",
66
"target": "es5",
7-
"jsx": "react",
8-
"allowSyntheticDefaultImports": true
7+
"lib": ["es6", "dom"],
8+
"jsx": "preserve",
9+
"allowSyntheticDefaultImports": true,
10+
"noErrorTruncation": true,
11+
"allowJs": true,
12+
"strict": true,
13+
"noEmit": true,
914
},
10-
"include": ["./src/**/*.ts"],
15+
"include": ["./src/**/*.ts", "./src/**/*.tsx", "./src/**/*.js"],
1116
"exclude": ["./dist"]
1217
}

packages/react-form-renderer/rollup.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import glob from 'glob';
99
import path from 'path';
1010
import sourcemaps from 'rollup-plugin-sourcemaps';
1111

12-
const outputPaths = [...glob.sync(path.resolve(__dirname, './src/files/!(*.d.ts)')), ...glob.sync(path.resolve(__dirname, './src/files/*.js'))];
12+
const outputPaths = [
13+
...glob.sync(path.resolve(__dirname, './src/files/!(*.d.ts)')),
14+
...glob.sync(path.resolve(__dirname, './src/files/*.(js|ts|tsx)'))
15+
];
1316

1417
const globals = {
1518
react: 'React',
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { DataTypeValidators } from '../validators';
2+
3+
export default function convertType(dataType: DataTypeValidators, value: any): any;

packages/react-form-renderer/src/common/isValidComponent.js

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
interface ActionMapper {
2+
[key: string]: (...args: any[]) => any;
3+
}
4+
5+
export default ActionMapper;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export interface ExtendedMapperComponent extends Object {
2+
component: string;
3+
}
4+
5+
interface ComponentMapper {
6+
[key: string]: string | ExtendedMapperComponent;
7+
}
8+
9+
export default ComponentMapper;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
export type ComponentType = 'text-field'|'field-array'|'checkbox'|'sub-form'|'radio'|'tabs'|'tab-item'|'date-picker'|'time-picker'|'wizard'|'switch'|'textarea'|'select'|'plain-text'|'button'|'input-addon-group'|'input-addon-button-group'|'dual-list-select'|'slider';
2+
3+
interface componentTypes {
4+
TEXT_FIELD: 'text-field';
5+
FIELD_ARRAY: 'field-array';
6+
CHECKBOX: 'checkbox';
7+
SUB_FORM: 'sub-form';
8+
RADIO: 'radio';
9+
TABS: 'tabs';
10+
TAB_ITEM: 'tab-item';
11+
DATE_PICKER: 'date-picker';
12+
TIME_PICKER: 'time-picker';
13+
WIZARD: 'wizard';
14+
SWITCH: 'switch';
15+
TEXTAREA: 'textarea';
16+
SELECT: 'select';
17+
PLAIN_TEXT: 'plain-text';
18+
BUTTON: 'button';
19+
INPUT_ADDON_GROUP: 'input-addon-group';
20+
INPUT_ADDON_BUTTON_GROUP: 'input-addon-button-group';
21+
DUAL_LIST_SELECT: 'dual-list-select';
22+
SLIDER: 'slider';
23+
}
24+
25+
export default componentTypes;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { ValidatorFunction } from '../validators';
2+
3+
export default function(validators: ValidatorFunction[]): ValidatorFunction;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export type DataType = 'integer'|'float'|'number'|'boolean'|'string';
2+
3+
interface dataTypes {
4+
INTEGER: 'integer';
5+
FLOAT: 'float';
6+
NUMBER: 'number';
7+
BOOLEAN: 'boolean';
8+
STRING: 'string';
9+
}
10+
11+
export default dataTypes;

0 commit comments

Comments
 (0)