/** The values that can be represented in JSON */ export type JSONValue = null | string | boolean | number | Array | JSONObject; /** * A JSON object. This is a map from strings to JSON values or `undefined`. We * allow `undefined` values as a convenience... but beware that the `undefined` * values do not round trip to the server. For example: * * ``` * // Time t1 * await tx.set('a', {a: undefined}); * * // time passes, in a new transaction * const v = await tx.get('a'); * console.log(v); // either {a: undefined} or {} * ``` */ export type JSONObject = { [key: string]: JSONValue | undefined; }; /** Like {@link JSONValue} but deeply readonly */ export type ReadonlyJSONValue = null | string | boolean | number | ReadonlyArray | ReadonlyJSONObject; /** Like {@link JSONObject} but deeply readonly */ export type ReadonlyJSONObject = { readonly [key: string]: ReadonlyJSONValue | undefined; }; /** * Checks deep equality of two JSON value with (almost) same semantics as * `JSON.stringify`. The only difference is that with `JSON.stringify` the * ordering of the properties in an object/map/dictionary matters. In * {@link deepEqual} the following two values are consider equal, even though the * strings JSON.stringify would produce is different: * * ```js * assert(deepEqual(t({a: 1, b: 2}, {b: 2, a: 1})) * ``` */ export declare function deepEqual(a: ReadonlyJSONValue | undefined, b: ReadonlyJSONValue | undefined): boolean; export declare function assertJSONValue(v: unknown): asserts v is JSONValue; export declare function assertJSONObject(v: unknown): asserts v is JSONObject; interface Path { push(key: string | number): void; pop(): void; } /** * Checks if a value is a JSON value. If there is a value that is not a JSON * value, the path parameter is updated to the path of the invalid value. */ export declare function isJSONValue(v: unknown, path: Path): v is JSONValue; export declare function isJSONObject(v: unknown, path: Path): v is JSONObject; /** Basic deep readonly type. It works for {@link JSONValue} types. */ export type DeepReadonly = T extends null | boolean | string | number | undefined ? T : { readonly [K in keyof T]: DeepReadonly; }; export {}; //# sourceMappingURL=json.d.ts.map