TraverseAsync<T, Depth extends number>: IsLiteralArray<T> extends 1
    ? Combine<T, Depth> extends [infer Oks, infer Errs]
        ? neverthrow.ResultAsync<EmptyArrayToNever<Oks>, MembersToUnion<Errs>>
        : never
    : T extends (infer I)[]
        ? Combine<MemberListOf<I>, Depth> extends [infer Oks, infer Errs]
            ? Oks extends unknown[]
                ? Errs extends unknown[]
                    ? neverthrow.ResultAsync<EmptyArrayToNever<Oks[number][]>, MembersToUnion<Errs[number][]>>
                    : neverthrow.ResultAsync<EmptyArrayToNever<Oks[number][]>, Errs>
                : Errs extends unknown[]
                    ? neverthrow.ResultAsync<Oks, MembersToUnion<Errs[number][]>>
                    : neverthrow.ResultAsync<Oks, Errs>
            : never
        : never

Type Parameters

  • T
  • Depth extends number = 5