Clean up types

- merge `ItemType`/`BlockType` to `TextType`
- fix bug with duplicate and flattened types
This commit is contained in:
Johannes Zillmann
2024-04-02 11:18:55 -06:00
parent 3c31c12768
commit b5f3075bdf
19 changed files with 327 additions and 178 deletions

View File

@ -1,11 +1,15 @@
import Item from './Item';
import ItemType from './ItemType';
import { HeadlineType } from './text-types';
/**
* Table of contents usually parsed by `DetectToc.ts`.
*/
export default class TOC {
constructor(public tocHeadlineItems: Item[], public pages: number[], public detectedHeadlineLevels: Set<ItemType>) {}
constructor(
public tocHeadlineItems: Item[],
public pages: number[],
public detectedHeadlineLevels: Set<HeadlineType>,
) {}
startPage(): number {
return Math.min(...this.pages);