// type RichnessNodeDefinition = { // type: N["type"] // measure(context: CanvasRenderingContext2D, node: N): Promise; // render( // context: CanvasRenderingContext2D, // node: N, // x: number, // y: number // ): Promise; // }; // type Richness = {[K in N["type"]]: RichnessNodeDefinition} // const drawRichText = ( // context: CanvasRenderingContext2D, // richness: Richness, // richText: N[], // x: number, // y: number, // maxWidth: number, // ) => { // context.save(); // const // context.restore(); // };