( errors: readonly ArkError[], locale: Locale.Resolved )
| 1276 | // that begins as the locale's own would is listed with what the others |
| 1277 | // expect, as a validator's is, whose issue holds only its message |
| 1278 | const sharedMessageOf = ( |
| 1279 | errors: readonly ArkError[], |
| 1280 | locale: Locale.Resolved |
| 1281 | ): string | undefined => { |
| 1282 | let shared: string | undefined |
| 1283 | for (const e of errors) { |
| 1284 | const text = |
| 1285 | ( |
| 1286 | configuredMessageOf(e) !== undefined || |
| 1287 | suppliedText(e, "message") !== undefined |
| 1288 | ) ? |
| 1289 | beginsAsOwn(e, locale) ? undefined |
| 1290 | : e.message |
| 1291 | : e.code === "union" ? sharedMessageOf(e.errors, locale) |
| 1292 | : undefined |
| 1293 | if (text === undefined || (shared !== undefined && text !== shared)) return |
| 1294 | shared = text |
| 1295 | } |
| 1296 | return shared |
| 1297 | } |
| 1298 | |
| 1299 | export const writeText = ( |
| 1300 | error: ArkError, |
no test coverage detected