UNPKG

ts-std-lib

Version:
27 lines (26 loc) 819 B
/** * Type safe JSON */ export declare type Json = string | number | boolean | null | undefined | JsonObject | JsonArray | IJsonSerializable; /** * Type safe JSON object */ export declare type JsonObject = { readonly [index: string]: Json; }; /** * Type safe JSON array */ export interface JsonArray extends ReadonlyArray<Json> { } /** * Convertible into a JSON string. */ export interface IJsonSerializable { /** * @param key If this object is a property value, the property name, if it is in an array, the index in the array, as a string, otherwise an empty string. */ toJSON(key?: string | number): Json; } export declare type Reviver<T> = (this: T, key: string, value: any) => any; export declare type Replacer<T> = (this: T, key: string, value: any) => any;