Closed
Description
I have a recursive type definition for JSON Serializable entities (Exhibit A, edited after discussion with @JsonFreeman ):
export type IJSONSerializable = IJSONSerializableObject | number | string | IMaybeRecursiveArray<IJSONSerializableObject | number | string>;
interface IMaybeRecursiveArray<T> {
[i: number]: T | IMaybeRecursiveArray<T>;
}
interface IJSONSerializableObject {
[paramKey: string]: IJSONSerializable
}
I would like to be able to write the following, but get a circular reference error (Exhibit B):
export type IJSONSerializable = {[paramKey: string]: IJSONSerializable} | number | string | Array<IJSONSerializable>;
How difficult would it be to address this limitation of the type system?