Skip to content

Instantly share code, notes, and snippets.

@thejhh
Last active December 12, 2020 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thejhh/fbd28efbff84d0d27721879ae7139f41 to your computer and use it in GitHub Desktop.
Save thejhh/fbd28efbff84d0d27721879ae7139f41 to your computer and use it in GitHub Desktop.
// Copyright (c) 2020 Sendanor. All rights reserved.
export interface JsonSerializable {
toJSON () : JsonAny;
}
export type JsonAny = string | number | boolean | null | JsonArray | JsonObject | JsonSerializable;
export type JsonObjectOf<T extends JsonAny> = { [name: string]: T | undefined };
export type JsonObject = { [name: string]: JsonAny | undefined };
export type JsonArrayOf<T extends JsonAny> = Array<T>;
export type JsonArray = Array<JsonAny>;
export type ReadonlyJsonAny = string | number | boolean | null | ReadonlyJsonArray | ReadonlyJsonObject;
export type ReadonlyJsonObjectOf<T extends ReadonlyJsonAny> = { readonly [name: string]: T | undefined };
export type ReadonlyJsonObject = { readonly [name: string]: ReadonlyJsonAny | undefined };
export type ReadonlyJsonArrayOf<T extends ReadonlyJsonAny> = ReadonlyArray<T>;
export type ReadonlyJsonArray = ReadonlyArray<ReadonlyJsonAny>;
export default JsonAny;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment