# types/chapter.types.ts

> 54 lines of code and 13 definitions.

Tree: Build tree
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/build#file-build-types-chapter-types-ts
Source text: https://banes-lab.com/assets/sources/source.804c448a2d4f2d88af47def7f8d5bc1179e6af3609900a09501d0102cb7315b0.generated.txt

## Definitions

- `Chapter` (interface_declaration, line 3, exported)
- `ChapterSource` (interface_declaration, line 9, exported)
- `LinkResolver` (type_alias_declaration, line 16, exported)
- `SiteOnlyTab` (interface_declaration, line 18, exported)
- `Attribution` (interface_declaration, line 23, exported)
- `ChapterShape` (type_alias_declaration, line 32, exported)
- `WikiPage` (interface_declaration, line 34, exported)
- `PageSources` (interface_declaration, line 42, exported)
- `ShapeInput` (interface_declaration, line 48, exported)
- `ShapeRenderer` (type_alias_declaration, line 53, exported)
- `SurfaceRendered` (interface_declaration, line 55, exported)
- `SurfaceRefused` (interface_declaration, line 62, exported)
- `SurfaceResult` (type_alias_declaration, line 67, exported)

## Source

```typescript
import type { ReadmeInputs } from "#types/readme.types";

export interface Chapter {
    readonly body: string;
    readonly file: string;
    readonly label: string;
}

export interface ChapterSource {
    readonly first: boolean;
    readonly label: string;
    readonly markdown: string;
    readonly tab: string;
}

export type LinkResolver = (page: string, tab: string | null) => string | null;

export interface SiteOnlyTab {
    readonly page: string;
    readonly tab: string;
}

export interface Attribution {
    readonly author: string;
    readonly copyright: string;
    readonly coveredBy: string;
    readonly licenseName: string;
    readonly licenseUrl: string;
    readonly work: string;
}

export type ChapterShape = "repository" | "wiki";

export interface WikiPage {
    readonly group: string;
    readonly hosted: boolean;
    readonly href: string;
    readonly page: string;
    readonly source: ChapterSource;
}

export interface PageSources {
    readonly label: string;
    readonly page: string;
    readonly sources: readonly ChapterSource[];
}

export interface ShapeInput {
    readonly pages: readonly PageSources[];
    readonly readme: ReadmeInputs | null;
}

export type ShapeRenderer = (input: ShapeInput, attribution: Attribution) => Chapter[];

export interface SurfaceRendered {
    readonly chapters: readonly Chapter[];
    readonly ok: true;
    readonly out: string;
    readonly removed: readonly string[];
}

export interface SurfaceRefused {
    readonly ok: false;
    readonly reason: string;
}

export type SurfaceResult = SurfaceRefused | SurfaceRendered;
```
