Skip to content

Commit 231ed86

Browse files
committed
fix(renderer): fixup typings requirements
1 parent b4bf0ca commit 231ed86

File tree

10 files changed

+50
-53
lines changed

10 files changed

+50
-53
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import { DataTypeValidators } from '../files/validators';
22

3-
export default function convertType(dataType: DataTypeValidators, value: any): any;
3+
export default function convertType(dataType: DataTypeValidators, value?: any): any;
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
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';
22

33
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';
4+
TEXT_FIELD: string;
5+
FIELD_ARRAY: string;
6+
CHECKBOX: string;
7+
SUB_FORM: string;
8+
RADIO: string;
9+
TABS: string;
10+
TAB_ITEM: string;
11+
DATE_PICKER: string;
12+
TIME_PICKER: string;
13+
WIZARD: string;
14+
SWITCH: string;
15+
TEXTAREA: string;
16+
SELECT: string;
17+
PLAIN_TEXT: string;
18+
BUTTON: string;
19+
INPUT_ADDON_GROUP: string;
20+
INPUT_ADDON_BUTTON_GROUP: string;
21+
DUAL_LIST_SELECT: string;
22+
SLIDER: string;
2323
}
2424

2525
export default componentTypes;
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
export type DataType = 'integer'|'float'|'number'|'boolean'|'string';
22

33
interface dataTypes {
4-
INTEGER: 'integer';
5-
FLOAT: 'float';
6-
NUMBER: 'number';
7-
BOOLEAN: 'boolean';
8-
STRING: 'string';
4+
INTEGER: string;
5+
FLOAT: string;
6+
NUMBER: string;
7+
BOOLEAN: string;
8+
STRING: string;
99
}
1010

1111
export default dataTypes;
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { ComponentType } from 'react';
2-
31
import { FieldArrayProps } from 'react-final-form-arrays';
42

53
export default FieldArrayProps;

packages/react-form-renderer/src/files/form-renderer.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ export interface FormSubscription {
1313
export interface FormRendererProps {
1414
initialValues?: object;
1515
onSubmit: (values: object, formApi: FormApi, callback: () => void) => Promise<any>;
16-
onCancel: () => void;
17-
onReset: () => void;
16+
onCancel?: () => void;
17+
onReset?: () => void;
1818
schema: Schema;
1919
clearOnUnmount?: boolean;
20-
subscription: FormSubscription;
21-
clearedValue: any;
20+
subscription?: FormSubscription;
21+
clearedValue?: any;
2222
componentMapper: ComponentMapper;
2323
FormTemplate: ComponentType;
24-
validatorMapper: ValidatorMapper;
25-
actionMapper: ActionMapper;
26-
schemaValidatorMapper: SchemaValidatorMapper;
24+
validatorMapper?: ValidatorMapper;
25+
actionMapper?: ActionMapper;
26+
schemaValidatorMapper?: SchemaValidatorMapper;
2727
}
2828

2929
declare const FormRenderer: React.ComponentType<FormRendererProps>;

packages/react-form-renderer/src/files/renderer-context.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import ActionMapper from './action-mapper';
66
import Field from './field';
77

88
export interface FormOptions extends FormApi {
9-
registerInputFile: (name: string) => void;
10-
unRegisterInputFile: (name: string) => void;
11-
onCancel: (values: object, ...args: any[]) => void;
12-
onReset: () => void;
13-
clearedValue: any;
9+
registerInputFile?: (name: string) => void;
10+
unRegisterInputFile?: (name: string) => void;
11+
onCancel?: (values: object, ...args: any[]) => void;
12+
onReset?: () => void;
13+
clearedValue?: any;
1414
renderForm: (fields: Field[]) => ReactNode[];
1515
}
1616

packages/react-form-renderer/src/files/use-field-api.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import { FieldInputProps, FieldMetaState } from 'react-final-form';
33

44
export interface ValidatorType extends Object {
55
type: string;
6-
message: ReactNode;
6+
message?: ReactNode;
77
}
88

99
export interface UseFieldApiConfig extends Object {
1010
name: string;
1111
component: string;
12-
validate: ValidatorType[];
12+
validate?: ValidatorType[];
1313
}
1414

1515
export interface UseFieldApiProps extends Object {
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useContext } from 'react';
2-
import RendererContext, { RendererContextValue } from './renderer-context';
1+
import { RendererContextValue } from './renderer-context';
32

43
export default function(): RendererContextValue;
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
interface validatorTypes {
2-
REQUIRED: 'required';
3-
MIN_LENGTH: 'min-length';
4-
MAX_LENGTH: 'max-length';
5-
EXACT_LENGTH: 'exact-length';
6-
MIN_ITEMS: 'min-items';
7-
MIN_NUMBER_VALUE: 'min-number-value';
8-
MAX_NUMBER_VALUE: 'max-number-value';
9-
PATTERN: 'pattern';
10-
URL: 'url';
2+
REQUIRED: string;
3+
MIN_LENGTH: string;
4+
MAX_LENGTH: string;
5+
EXACT_LENGTH: string;
6+
MIN_ITEMS: string;
7+
MIN_NUMBER_VALUE: string;
8+
MAX_NUMBER_VALUE: string;
9+
PATTERN: string;
10+
URL: string;
1111
}
1212

1313
export default validatorTypes;

packages/react-form-renderer/src/validators/helpers.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { MessageTypes } from "./messages";
77
export function memoize(func: Function): ValidatorFunction;
88

99
export interface MessageObject {
10-
msg: ReactNode;
10+
msg?: ReactNode;
1111
defaultMessage: ReactNode;
1212
values: object;
1313
}

0 commit comments

Comments
 (0)