UNPKG

879 BTypeScriptView Raw
1import type { Document } from '../doc/Document.js';
2import type { Node } from './Node.js';
3export interface AnchorData {
4 aliasCount: number;
5 count: number;
6 res: unknown;
7}
8export interface ToJSContext {
9 anchors: Map<Node, AnchorData>;
10 doc: Document<Node, boolean>;
11 keep: boolean;
12 mapAsMap: boolean;
13 mapKeyWarned: boolean;
14 maxAliasCount: number;
15 onCreate?: (res: unknown) => void;
16}
17/**
18 * Recursively convert any node or its contents to native JavaScript
19 *
20 * @param value - The input value
21 * @param arg - If `value` defines a `toJSON()` method, use this
22 * as its first argument
23 * @param ctx - Conversion context, originally set in Document#toJS(). If
24 * `{ keep: true }` is not set, output should be suitable for JSON
25 * stringification.
26 */
27export declare function toJS(value: any, arg: string | null, ctx?: ToJSContext): any;