UNPKG

1.12 kBTypeScriptView Raw
1import type { CreateNodeContext } from '../doc/createNode';
2import type { CollectionItem } from '../parse/cst';
3import type { Schema } from '../schema/Schema';
4import type { StringifyContext } from '../stringify/stringify';
5import { addPairToJSMap } from './addPairToJSMap';
6import { NODE_TYPE } from './identity';
7import type { Node } from './Node';
8import type { ToJSContext } from './toJS';
9export declare function createPair(key: unknown, value: unknown, ctx: CreateNodeContext): Pair<Node, Node>;
10export declare class Pair<K = unknown, V = unknown> {
11 readonly [NODE_TYPE]: symbol;
12 /** Always Node or null when parsed, but can be set to anything. */
13 key: K;
14 /** Always Node or null when parsed, but can be set to anything. */
15 value: V | null;
16 /** The CST token that was composed into this pair. */
17 srcToken?: CollectionItem;
18 constructor(key: K, value?: V | null);
19 clone(schema?: Schema): Pair<K, V>;
20 toJSON(_?: unknown, ctx?: ToJSContext): ReturnType<typeof addPairToJSMap>;
21 toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
22}