declare const commentCollectionNode: unique symbol; export interface NodeComments { comment?: Comment | undefined; commentBefore?: Comment | undefined; } export interface CommentedBaseNode extends NodeComments { [commentCollectionNode]?: CommentedCollectionNode | undefined; } export interface CommentedScalar extends CommentedBaseNode { readonly value: T; set(value: T): void; } export type ScalarNumber = CommentedScalar; export type ScalarString = CommentedScalar; export type ScalarBoolean = CommentedScalar; export type ScalarUndefined = CommentedScalar; export type ScalarNull = CommentedScalar; export interface Comment { comment: string; block?: boolean | undefined; } export type CommentedNode = T extends number | string | boolean | null | undefined ? CommentedScalar : T extends [] ? CommentedArrayNode : T extends object ? CommentedRecordNode : never; export interface CommentedCollectionNode extends CommentedBaseNode { /** * Check if a node exists in the collection. * @param n - node to check for. * @returns true if the node is in the collection. */ has(n: CommentedBaseNode): boolean; /** * Remove a node from the collection. * @param n - node to remove * @returns true if the node was removed */ remove(n: CommentedBaseNode): boolean; /** * The number of items in the collection. */ readonly size: number; } type ChildNode = CommentedNode; export interface CommentedArrayNode extends CommentedCollectionNode, Iterable> { readonly value: T[]; readonly items: ChildNode[]; get(index: number): ChildNode | undefined; set(index: number, value: T | CommentedNode): void; add(value: T | CommentedNode): void; } export interface CommentedRecordNode extends CommentedCollectionNode, Iterable<[keyof T, CommentedNode]> { readonly value: T; readonly items: [keyof T, ChildNode][]; get(key: K): ChildNode | undefined; set(key: K, value: T[K] | CommentedNode): void; } export declare function createCommentedScalar(value: number, comments?: NodeComments): ScalarNode; export declare function createCommentedScalar(value: string, comments?: NodeComments): ScalarNode; export declare function createCommentedScalar(value: boolean, comments?: NodeComments): ScalarNode; export declare function createCommentedScalar(value: null, comments?: NodeComments): ScalarNode; export declare function createCommentedScalar(value: undefined, comments?: NodeComments): ScalarNode; export declare function createCommentedScalar(value: T, comments?: NodeComments): ScalarNode; export declare function isCommentedBaseNode(node: unknown): node is CommentedBaseNode; export declare function isCommentedScalar(node: unknown): node is CommentedScalar; export declare function isCommentedNode(value: T | CommentedNode): value is CommentedNode; declare class BaseNode { parent?: CommentedCollectionNode | undefined; comment?: Comment | undefined; commentBefore?: Comment | undefined; constructor(comments?: NodeComments); } declare class ScalarNode extends BaseNode implements CommentedScalar { value: T; constructor(value: T, comments?: NodeComments); set(value: T): void; toJSON(): T; } export declare function createCommentedNode(value: T, comments?: NodeComments): CommentedNode; export {}; //# sourceMappingURL=Commented.d.ts.map