( error: unknown, pathSuffix: ReadonlyArray<string | number> )
| 89 | * `path: ['name']` and `path: ['updates', 'name']`. |
| 90 | */ |
| 91 | export function findValidationIssue( |
| 92 | error: unknown, |
| 93 | pathSuffix: ReadonlyArray<string | number> |
| 94 | ): ValidationIssue | null { |
| 95 | const issues = extractValidationIssues(error) |
| 96 | for (const issue of issues) { |
| 97 | if (issue.path.length < pathSuffix.length) continue |
| 98 | const tail = issue.path.slice(issue.path.length - pathSuffix.length) |
| 99 | if (tail.every((segment, i) => segment === pathSuffix[i])) return issue |
| 100 | } |
| 101 | return null |
| 102 | } |
| 103 | |
| 104 | /** True when the error is a recognised validation failure (client or server). */ |
| 105 | export function isValidationError(error: unknown): boolean { |
no test coverage detected