Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typing for rules in nested validate object. #3110

Merged
merged 1 commit into from Dec 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/mantine-form/src/types.ts
Expand Up @@ -30,11 +30,11 @@ type FormRule<Value, Values> = NonNullable<Value> extends Array<infer ListValue>
}>
| Rule<Value, Values>
: NonNullable<Value> extends Record<string, unknown>
? FormRulesRecord<Value> | Rule<Value, Values>
? FormRulesRecord<Value, Values> | Rule<Value, Values>
: Rule<Value, Values>;

export type FormRulesRecord<Values> = Partial<{
[Key in keyof Values]: FormRule<Values[Key], Values>;
export type FormRulesRecord<Values, InitValues = Values> = Partial<{
[Key in keyof Values]: FormRule<Values[Key], InitValues>;
}>;

export type FormValidateInput<Values> = FormRulesRecord<Values> | ((values: Values) => FormErrors);
Expand Down