# Index

TYPE in `@skmtc/core 0.63.4`

A place that holds definitions, and the one way to write and read them.

A code file is the root Index of its content: every generator can reach it.
A definition whose value is an Index is a place too - a Kotlin class body,
a TypeScript class - so Indexes nest, and a definition is found by the
path of identifiers that leads to it.

Each language decides what its Indexes accept and how they render. The
engine speaks only these two operations, and
`CodeFileBase` already satisfies them.

## Signature

```ts
import type { Index } from '@skmtc/core'
```

## Properties

- `addDefinition` ((definition: DefinitionBase) => void, required): Add a definition, applying this Index's rules: the entity types it accepts, the generator that owns it, and its duplicate rule. A rule break throws. Called by the engine's `register`.
- `findDefinitions` ((query?: FindDefinitionsQuery) => DefinitionBase[] | undefined, required): Matching definitions, or `undefined` when nothing matches. With no query, every definition.
