/** * @fileoverview Functions for extracting and applying serialization metadata * to JSON. When a JS object is serialized to JSON it will call the `toJSON` * and `toString` methods on objects. When deserializing the original types of * those values are lost. This library exports `collectMeta` which returns a * JSON-serializable representation of how the original object will be * serialized. This can be passed to `hydrateObject` to restore the * original object. Currently supports `Date` and `URL` values. */ /** Type of value that can be restored. */ export declare enum EncodedType { DATE = "date", URL = "url" } export type HydrationMeta = Record; /** * Restores the type of values after deserializing a JSON object. Meta must be * the object returned from `collectMeta`. Mutates the object in place. */ export declare function hydrateObject(meta: HydrationMeta, value: any): void; /** * Walks an object and extracts information for hydrating it after * deserialization. */ export declare function collectMeta(obj: unknown): HydrationMeta;