| 70 | }; |
| 71 | |
| 72 | export function addIssueToContext(ctx: ParseContext, issueData: IssueData): void { |
| 73 | const overrideMap = getErrorMap(); |
| 74 | const issue = makeIssue({ |
| 75 | issueData: issueData, |
| 76 | data: ctx.data, |
| 77 | path: ctx.path, |
| 78 | errorMaps: [ |
| 79 | ctx.common.contextualErrorMap, // contextual error map is first priority |
| 80 | ctx.schemaErrorMap, // then schema-bound map if available |
| 81 | overrideMap, // then global override map |
| 82 | overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map |
| 83 | ].filter((x) => !!x), |
| 84 | }); |
| 85 | ctx.common.issues.push(issue); |
| 86 | } |
| 87 | |
| 88 | export type ObjectPair = { |
| 89 | key: SyncParseReturnType<any>; |