import type { AnyRecord } from '../Shared/Types'; import type { JSONObject } from './JSON'; /** * JSON of a serializable class. */ export interface JSON extends JSONObject { $class: T; } /** * Creates a class instance from the given JSON, if a suitable serializer * has been found. * * @function Serializable.fromJSON * * @param {JSON} json * JSON to create a class instance or object from. * * @return {AnyRecord} * Returns the class instance or object, or throws an exception. */ export declare function fromJSON(json: JSON): AnyRecord; /** * Registers a class prototype for the given JSON $class. * * @function Serializable.registerClassPrototype * * @param {string} $class * JSON $class to register for. * * @param {Serializable} classPrototype * Class to register. */ export declare function registerClassPrototype>($class: TJSON['$class'], classPrototype: Serializable): void; /** * Registers helper functions for the given JSON $class. * * @function Serializable.registerHelper * * @param {Helper} helperFunctions * Helper functions to register. */ export declare function registerHelper>(helperFunctions: Helper): void; export declare function toJSON>(obj: Serializable): TJSON; export declare function toJSON(obj: AnyRecord): JSON; declare const Serializable: { fromJSON: typeof fromJSON; registerClassPrototype: typeof registerClassPrototype; registerHelper: typeof registerHelper; toJSON: typeof toJSON; }; export default Serializable;