export interface TextNode { readonly text: string; } export interface VoidNode { } export type InlineNode = TextNode | VoidNode; export interface BlockNode { readonly children: readonly InlineNode[]; } export type Node = BlockNode | InlineNode; export interface DocNode { readonly children: readonly BlockNode[]; } export type Fragment = DocNode["children"]; type InferChild = T extends { children: readonly (infer N)[]; } ? InferChild : T; type InferBlock = T extends { children: readonly (infer N)[]; } ? T & InferBlock : T; export type InferInlineNode = InferChild; export type InferBlockNode = InferBlock; export type Path = readonly [number?]; export type Position = readonly [path: Path, offset: number]; export type Range = readonly [start: Position, end: Position]; export type SelectionSnapshot = readonly [anchor: Position, focus: Position]; export {};