-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
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?
carlpaten, Dao007forever, pmunin, tinganho and dontsave
Metadata
Metadata
Assignees
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript