Нема описа

toJS.d.ts 1.0KB

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