( result: ParsePayload, final: ParsePayload, key: PropertyKey, input: any, isOptionalIn: boolean, isOptionalOut: boolean )
| 1748 | >; |
| 1749 | |
| 1750 | function handlePropertyResult( |
| 1751 | result: ParsePayload, |
| 1752 | final: ParsePayload, |
| 1753 | key: PropertyKey, |
| 1754 | input: any, |
| 1755 | isOptionalIn: boolean, |
| 1756 | isOptionalOut: boolean |
| 1757 | ) { |
| 1758 | const isPresent = key in input; |
| 1759 | if (result.issues.length) { |
| 1760 | // For optional-in/out schemas, ignore errors on absent keys. |
| 1761 | if (isOptionalIn && isOptionalOut && !isPresent) { |
| 1762 | return; |
| 1763 | } |
| 1764 | final.issues.push(...util.prefixIssues(key, result.issues)); |
| 1765 | } |
| 1766 | |
| 1767 | if (!isPresent && !isOptionalIn) { |
| 1768 | if (!result.issues.length) { |
| 1769 | final.issues.push({ |
| 1770 | code: "invalid_type", |
| 1771 | expected: "nonoptional", |
| 1772 | input: undefined, |
| 1773 | path: [key], |
| 1774 | }); |
| 1775 | } |
| 1776 | return; |
| 1777 | } |
| 1778 | |
| 1779 | if (result.value === undefined) { |
| 1780 | if (isPresent) { |
| 1781 | (final.value as any)[key] = undefined; |
| 1782 | } |
| 1783 | } else { |
| 1784 | (final.value as any)[key] = result.value; |
| 1785 | } |
| 1786 | } |
| 1787 | |
| 1788 | export type $ZodObjectConfig = { out: Record<string, unknown>; in: Record<string, unknown> }; |
| 1789 |
no outgoing calls
no test coverage detected