aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/components/input/InputGroup.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'FrontEnd/src/components/input/InputGroup.tsx')
-rw-r--r--FrontEnd/src/components/input/InputGroup.tsx16
1 files changed, 8 insertions, 8 deletions
diff --git a/FrontEnd/src/components/input/InputGroup.tsx b/FrontEnd/src/components/input/InputGroup.tsx
index 4f487344..47a43b38 100644
--- a/FrontEnd/src/components/input/InputGroup.tsx
+++ b/FrontEnd/src/components/input/InputGroup.tsx
@@ -72,12 +72,9 @@ export type InputDirtyDict = Record<string, boolean>;
// use never so you don't have to cast everywhere
export type InputConfirmValueDict = Record<string, never>;
-export type GeneralInputErrorDict =
- | {
- [key: string]: Text | null | undefined;
- }
- | null
- | undefined;
+export type GeneralInputErrorDict = {
+ [key: string]: Text | null | undefined;
+};
type MakeInputInfo<I extends Input> = Omit<I, "value" | "error" | "disabled">;
@@ -87,8 +84,9 @@ export type InputInfo = {
export type Validator = (
values: InputValueDict,
+ errors: GeneralInputErrorDict,
inputs: InputInfo[],
-) => GeneralInputErrorDict;
+) => void;
export type InputScheme = {
inputs: InputInfo[];
@@ -157,7 +155,9 @@ function validate(
values: InputValueDict,
inputs: InputInfo[],
): InputErrorDict {
- return cleanObject(validator?.(values, inputs) ?? {});
+ const errors: GeneralInputErrorDict = {};
+ validator?.(values, errors, inputs);
+ return cleanObject(errors);
}
export function useInputs(options: { init: Initializer }): {