( error: ArkError, config: ResolvedConfig, last: "expected" | "actual" )
| 199 | |
| 200 | // only the slots its expected reads, so no writer is called twice |
| 201 | const writeInEn = ( |
| 202 | error: ArkError, |
| 203 | config: ResolvedConfig, |
| 204 | last: "expected" | "actual" |
| 205 | ): void => { |
| 206 | // a union's expected reads its children's actual |
| 207 | if (error.code === "union") |
| 208 | for (const e of error.errors) writeInEn(e, config, "actual") |
| 209 | error.propString ??= stringifyPath(error.path) |
| 210 | const expected = configOf(error, "expected", config) |
| 211 | error.expected ??= writeExpected(error, expected as never, defaultLocale) |
| 212 | if (last === "expected") return |
| 213 | error.actual ??= writeActual( |
| 214 | error, |
| 215 | configOf(error, "actual", config) as never, |
| 216 | defaultLocale |
| 217 | ) |
| 218 | } |
| 219 | |
| 220 | const writeExpected = ( |
| 221 | error: ArkError, |
no test coverage detected