fix: add missing JSDoc, return types, and as-any comments to layout engines

This commit is contained in:
Ilia Mashkov
2026-04-12 09:51:36 +03:00
parent 49822f8af7
commit 4b017a83bb
3 changed files with 78 additions and 11 deletions
@@ -24,7 +24,11 @@ export interface LayoutLine {
}>;
}
/**
* Aggregated output of a single-font layout pass.
*/
export interface LayoutResult {
/** Per-line grapheme data. Empty when input text is empty. */
lines: LayoutLine[];
/** Total height in pixels. Equals `lines.length * lineHeight` (pretext guarantee). */
totalHeight: number;
@@ -61,6 +65,7 @@ export class TextLayoutEngine {
*/
#segmenter: Intl.Segmenter;
/** @param locale BCP 47 language tag passed to Intl.Segmenter. Defaults to the runtime locale. */
constructor(locale?: string) {
this.#segmenter = new Intl.Segmenter(locale, { granularity: 'grapheme' });
}