# types/check.types.ts

> 68 lines of code and 15 definitions.

Tree: GovLab Context
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/context#file-context-types-check-types-ts
Source text: https://banes-lab.com/source/context/types/check.types.ts.txt

Listed in [types](https://banes-lab.com/api/source/context/types.md), after [types/architecture.types.ts](https://banes-lab.com/source/context/types/architecture.types.ts.md) and before [types/concept.types.ts](https://banes-lab.com/source/context/types/concept.types.ts.md).

## Definitions

- `CheckQuestion` (type_alias_declaration, line 3, exported)
- `CheckAnswers` (type_alias_declaration, line 5, exported)
- `CheckFacet` (interface_declaration, line 7, exported)
- `CheckedRecord` (interface_declaration, line 11, exported)
- `UncheckedRecord` (interface_declaration, line 21, exported)
- `UnresolvedCheckRef` (interface_declaration, line 27, exported)
- `SecondCheckHome` (interface_declaration, line 34, exported)
- `QuestionCoverage` (interface_declaration, line 40, exported)
- `CollectionCoverage` (interface_declaration, line 46, exported)
- `CheckDeclaration` (interface_declaration, line 52, exported)
- `DeclaredCheck` (interface_declaration, line 57, exported)
- `DeclarationField` (type_alias_declaration, line 61, exported)
- `CheckDeclarationDefect` (interface_declaration, line 63, exported)
- `CheckGaps` (interface_declaration, line 70, exported)
- `CheckResolver` (interface_declaration, line 80, exported)

## Contained in

- [types](https://banes-lab.com/anatomy/context/folder-context-types.md)

## Source

```typescript
import type { CHECK_QUESTIONS } from "#configuration/constants/check.constants";

export type CheckQuestion = (typeof CHECK_QUESTIONS)[number];

export type CheckAnswers = Partial<Record<CheckQuestion, string>>;

export interface CheckFacet extends CheckAnswers {
    by?: string[];
}

export interface CheckedRecord {
    by: readonly string[];
    collection: string;
    dependsOn: readonly string[];
    facet: CheckFacet | null;
    id: string;
    ownBy: readonly string[];
    shape: readonly string[];
}

export interface UncheckedRecord {
    collection: string;
    id: string;
    missing: string[];
}

export interface UnresolvedCheckRef {
    collection: string;
    field: string;
    id: string;
    ref: string;
}

export interface SecondCheckHome {
    collection: string;
    id: string;
    home: string;
}

export interface QuestionCoverage {
    answered: number;
    declaredAbsent: number;
    question: string;
}

export interface CollectionCoverage {
    collection: string;
    questions: QuestionCoverage[];
    records: number;
}

export interface CheckDeclaration {
    readonly detects: readonly string[];
    readonly enforces: readonly string[];
}

export interface DeclaredCheck extends CheckDeclaration {
    readonly check: string;
}

export type DeclarationField = keyof CheckDeclaration;

export interface CheckDeclarationDefect {
    check: string;
    field: DeclarationField;
    ref: string;
    resolved: boolean;
}

export interface CheckGaps {
    checkDeclarationDefects: CheckDeclarationDefect[];
    collections: CollectionCoverage[];
    uncoveredCollections: string[];
    secondCheckHomes: SecondCheckHome[];
    unreachedByPropagation: string[];
    uncheckedRecords: UncheckedRecord[];
    unresolvedCheckRefs: UnresolvedCheckRef[];
}

export interface CheckResolver {
    collections: ReadonlySet<string>;
    resolve: (ref: string) => boolean;
}
```
