toJS.d.ts 879 B

123456789101112131415161718192021222324252627
  1. import type { Document } from '../doc/Document.js';
  2. import type { Node } from './Node.js';
  3. export interface AnchorData {
  4. aliasCount: number;
  5. count: number;
  6. res: unknown;
  7. }
  8. export 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. */
  27. export declare function toJS(value: any, arg: string | null, ctx?: ToJSContext): any;