# TsModelProjectionInstance

TYPE in `@skmtc/lang-typescript 0.19.1`

What a model projection gets from its TypeScript base class, on `this`.

## Signature

```ts
import type { TsModelProjectionInstance } from '@skmtc/lang-typescript'

interface TsModelProjectionInstance<EnrichmentType = undefined, ProjectionOptions = undefined> extends ModelProjectionInstance<EnrichmentType, ProjectionOptions>, TsProjectionRegister
```

## Properties

- `settings` (ContentSettings<EnrichmentType>, required): The projection's identifier, export path, variant and enrichments.
- `ref` (RefParts, required): The ref this model is built for (see `RefParts`).
- `options` (ProjectionOptions, required): The caller's options.
- `context` (GenerateContextType, required): The generation context providing access to OAS objects and utilities
- `skipped` (boolean, required): Whether this generator has been skipped
- `generatorKey` (GeneratorKey | undefined, required): Optional generator key - attribution input only
- `stackTrail` (StackTrail, required): Position of the schema fragment this snippet was built from, as a `StackTrail`. Callers pass a stable snapshot (a **clone** taken at the call site - `StackTrail` is mutable, so an un-cloned reference would alias a trail that later append/remove calls could mutate). The empty trail (`StackTrail.empty()`) means "no single originating node", in which case the resolver uses the generator-key-derived pointer. Converted to a JSON Pointer string only at the resolver - never carried as a string here.
- `insertModel` (<V extends GeneratedValue, PeerEnrichmentType = undefined, PeerProjectionOptions = undefined>(projection: ModelProjection<V, PeerEnrichmentType, PeerProjectionOptions>, ref: RefParts, ...rest: ProjectionOptionsRest<PeerInsertOptions<PeerProjectionOptions>, PeerProjectionOptions>) => Inserted<V, PeerEnrichmentType>, required): Insert a related model and return its `Inserted` reference. The model's name is imported into this projection's file when it is in another one. Pass `{ variant }` for a variant of the model other than `'main'`. `{ options }` is required when the peer declares options and refused when it does not. `{ noExport: true }` makes a definition that is not exported. Use it only when the peer's export path is this projection's file and no other file uses the definition: imports are added without a check for it. It has no effect on a definition that exists already.
- `insertNormalizedModel` (<V extends GeneratedValue, Schema extends OasSchema | OasRef<'schema'> | OasVoid, PeerEnrichmentType = undefined, PeerProjectionOptions = undefined>(projection: NormalizedModelProjection<V, PeerEnrichmentType, PeerProjectionOptions>, args: Omit<InsertNormalizedModelArgs<Schema>, 'destinationPath'>, ...rest: ProjectionOptionsRest<InsertNormalizedModelOptions<PeerProjectionOptions>, PeerProjectionOptions>) => InsertNormalizedModelReturn<V, Schema>, required): Insert a schema that can be a `$ref` or an inline schema, such as a request body. A `$ref` inserts its model. An inline schema becomes a definition named `fallbackName` in this projection's file. `{ variant }` and `{ options }` reach the `$ref` branch only. For an inline schema, put what distinguishes it into `fallbackName`. `{ noExport: true }` reaches both branches, and makes a definition that is not exported. Use it only when no other file uses the definition. For a `$ref`, the peer's export path must also be this projection's file: imports are added without a check for `noExport`. It has no effect on a definition that exists already.
- `register` ((args: TsRegisterArgs) => void, required): Register imports and definitions in this projection's **own** export file (`this.settings.exportPath`). For a different file use `registerInto`.
- `registerInto` ((destinationPath: string, args: TsRegisterArgs) => void, required): Register imports and definitions in the file you name. `register` always uses this projection's own export file.
