(issue: unknown)
| 2 | import { isPropertyKey, isTypescriptObject } from '@orpc/shared' |
| 3 | |
| 4 | export function isSchemaIssue(issue: unknown): issue is SchemaIssue { |
| 5 | if (!isTypescriptObject(issue) || typeof issue.message !== 'string') { |
| 6 | return false |
| 7 | } |
| 8 | |
| 9 | if (issue.path !== undefined) { |
| 10 | if (!Array.isArray(issue.path)) { |
| 11 | return false |
| 12 | } |
| 13 | |
| 14 | if ( |
| 15 | !issue.path.every(segment => isPropertyKey(segment) || (isTypescriptObject(segment) && isPropertyKey(segment.key))) |
| 16 | ) { |
| 17 | return false |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | return true |
| 22 | } |
no test coverage detected