I have the following code:
type Document = number | string | Array;
TypeScript complains with the following error:
The creator of TypeScript explains how to create recursive types here.
The workaround for the circular reference is to use extends Array. In your case this would lead to this solution:
type Document = number | string | DocumentArray;
interface DocumentArray extends Array { }
Update (TypeScript 3.7)
Starting with TypeScript 3.7, recursive type aliases will be permitted and the workaround will no longer be needed. See: https://github.com/microsoft/TypeScript/pull/33050