UNPKG

@promptbook/remote-client

Version:

Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action

42 lines (41 loc) 1.38 kB
import type { string_name } from '../../types/string_name'; import type { really_unknown } from '../organization/really_unknown'; /** * Options for the `checkSerializableAsJson` function */ export type CheckSerializableAsJsonOptions = { /** * Value to be checked */ value: really_unknown; /** * Semantic name of the value for debugging purposes */ name?: string_name; /** * Message alongside the value for debugging purposes */ message?: string; }; /** * Checks if the value is [🚉] serializable as JSON * If not, throws an UnexpectedError with a rich error message and tracking * * - Almost all primitives are serializable BUT: * - `undefined` is not serializable * - `NaN` is not serializable * - Objects and arrays are serializable if all their properties are serializable * - Functions are not serializable * - Circular references are not serializable * - `Date` objects are not serializable * - `Map` and `Set` objects are not serializable * - `RegExp` objects are not serializable * - `Error` objects are not serializable * - `Symbol` objects are not serializable * - And much more... * * @throws UnexpectedError if the value is not serializable as JSON * * @public exported from `@promptbook/utils` */ export declare function checkSerializableAsJson(options: CheckSerializableAsJsonOptions): void;