Close dialog on status change
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
type IssueLike = {
|
||||
path: PropertyKey[]
|
||||
message: string
|
||||
}
|
||||
path: PropertyKey[];
|
||||
message: string;
|
||||
};
|
||||
|
||||
export function zodIssuesToRecord(
|
||||
issues: IssueLike[]
|
||||
): Record<string, string[]> {
|
||||
const out: Record<string, string[]> = {}
|
||||
export function zodIssuesToRecord(issues: IssueLike[]): Record<string, string[]> {
|
||||
const out: Record<string, string[]> = {};
|
||||
|
||||
for (const issue of issues) {
|
||||
const key = issue.path.length ? issue.path.join('.') : 'root'
|
||||
out[key] ??= []
|
||||
out[key].push(issue.message)
|
||||
const key = issue.path.length ? issue.path.join('.') : 'root';
|
||||
out[key] ??= [];
|
||||
out[key].push(issue.message);
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user