import type { JsonPrimitive } from "./JsonPrimitive"; /** * An arbitrary serializable complex object. * * Unfortunately recursive structures (like JSON) must be represented in TypeScript using a recursive type rather than * multiple cyclic types. I.e. if recursion exists in the type definition, it must only be the type referring onto * itself, rather than type X referring to another type Z, where type Z refers back to type X. If you implement the * latter, you will receive the following compiler error when using the various 'Deep*' helper types with any type that * references your cyclic type: * * "TS2589: Type instantiation is excessively deep and possibly infinite." * * Limitation: nested arrays are supported, but we need to statically define to what depth here. Below we're only * supporting 1-ary arrays, but you can add more levels if/when needed. */ export interface JsonObject { [key: string]: JsonPrimitive | JsonObject | Array; }