Feasibility of stopping infinite nesting

Hi, I was experimenting with swift and made this:

enum NDArrayElement<I, S: Sequence> where S.Element == NDArrayElement {
    case item(I)
    case subsequence(S)
}

so I can define nested sequences of arbitrary length; [(Q|(W|(E|(R|(...)))))] for example. The obvious problem with it when it comes to implementation in code is that nothing can restrict the depth of nesting, which turns this approach into a useless one. What I want is to somehow explicitly terminate the depth, like this: [(Int|(Double|None))], so the following code works:

var ar = Array<NDArrayElement<Int, NDArrayElement<Double, Never>>>()
ar.append(contentsOf: [.item(1), .item(5), .subsequence([.item(2.5), .item(4.5)])])

Right now the compiler throws a bunch of errors about the incompatibility of Never and Sequence.

With all this being said, I would like to know whether you have ever encountered such a problem and how to terminate infinite recursion.