| 98 | } |
| 99 | |
| 100 | const render = ( |
| 101 | error: ArkError, |
| 102 | slot: Exclude<ErrorSlot, "expected">, |
| 103 | expected: SlotConfig, |
| 104 | cited: string | undefined, |
| 105 | config: ResolvedConfig, |
| 106 | locale: Locale.Resolved |
| 107 | ): string => { |
| 108 | const slotConfig = configOf(error, slot, config) |
| 109 | const isDefault = slotConfig === defaultConfig[error.code][slot] |
| 110 | // a locale's own actual describes the data as en's does, so its messages |
| 111 | // can leave it out through printedActualOf. A missing key's isn't, since |
| 112 | // its message says it was missing |
| 113 | if (isDefault && slot === "actual" && error.code !== "required") |
| 114 | describeActual(error) |
| 115 | return writeSlot( |
| 116 | error, |
| 117 | slot, |
| 118 | isDefault ? localeWriter(error, slot, expected, cited, locale) : slotConfig, |
| 119 | locale |
| 120 | ) |
| 121 | } |
| 122 | |
| 123 | const configOf = ( |
| 124 | error: ArkError, |