(input)
| 31810 | }; |
| 31811 | var ZodTuple = class _ZodTuple extends ZodType { |
| 31812 | _parse(input) { |
| 31813 | const { status, ctx } = this._processInputParams(input); |
| 31814 | if (ctx.parsedType !== util_1.ZodParsedType.array) { |
| 31815 | (0, parseUtil_1.addIssueToContext)(ctx, { |
| 31816 | code: ZodError_1.ZodIssueCode.invalid_type, |
| 31817 | expected: util_1.ZodParsedType.array, |
| 31818 | received: ctx.parsedType |
| 31819 | }); |
| 31820 | return parseUtil_1.INVALID; |
| 31821 | } |
| 31822 | if (ctx.data.length < this._def.items.length) { |
| 31823 | (0, parseUtil_1.addIssueToContext)(ctx, { |
| 31824 | code: ZodError_1.ZodIssueCode.too_small, |
| 31825 | minimum: this._def.items.length, |
| 31826 | inclusive: true, |
| 31827 | exact: false, |
| 31828 | type: "array" |
| 31829 | }); |
| 31830 | return parseUtil_1.INVALID; |
| 31831 | } |
| 31832 | const rest = this._def.rest; |
| 31833 | if (!rest && ctx.data.length > this._def.items.length) { |
| 31834 | (0, parseUtil_1.addIssueToContext)(ctx, { |
| 31835 | code: ZodError_1.ZodIssueCode.too_big, |
| 31836 | maximum: this._def.items.length, |
| 31837 | inclusive: true, |
| 31838 | exact: false, |
| 31839 | type: "array" |
| 31840 | }); |
| 31841 | status.dirty(); |
| 31842 | } |
| 31843 | const items = [...ctx.data].map((item, itemIndex) => { |
| 31844 | const schema = this._def.items[itemIndex] || this._def.rest; |
| 31845 | if (!schema) |
| 31846 | return null; |
| 31847 | return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex)); |
| 31848 | }).filter((x5) => !!x5); |
| 31849 | if (ctx.common.async) { |
| 31850 | return Promise.all(items).then((results) => { |
| 31851 | return parseUtil_1.ParseStatus.mergeArray(status, results); |
| 31852 | }); |
| 31853 | } else { |
| 31854 | return parseUtil_1.ParseStatus.mergeArray(status, items); |
| 31855 | } |
| 31856 | } |
| 31857 | get items() { |
| 31858 | return this._def.items; |
| 31859 | } |
nothing calls this directly
no test coverage detected