# toTsModelProjectionBase

FUNCTION in `@skmtc/lang-typescript 0.19.1`

Build a TypeScript model projection base class.

Thin veneer over core's `toModelProjectionBase`: passes `TsSnippet` as the
base (the hierarchy is language-bound at its root) and adds the register
ergonomics core deliberately doesn't define - typed with TypeScript's
concise vocabulary, which core can't name (F10):

- `register(args)` - **own-file**: `destinationPath` is always this
  projection's `settings.exportPath` (the foundation rule; never a
  fallback).
- `registerInto(destinationPath, args)` - the explicit cross-file path.

Both delegate to this package's register *function* - never
`super.register` (lang-base members are type-erased on core's factory
result).

The config is core's `ModelProjectionBaseConfig` parameterized over
`TsIdentifierType` (so `toIdentifierType`'s return tightens to the
`type` bound to `TsEntityType`). The base is the factory's first argument,
not a config field.

`ProjectionOptions` - the caller options the projection declares (see
core's `ProjectionOptions`) - is forwarded to the config unchanged.

## Signature

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

toTsModelProjectionBase<EnrichmentType = undefined, ProjectionOptions = undefined>(
  config: ModelProjectionBaseConfig<EnrichmentType, TsIdentifierType, ProjectionOptions>
): TsModelProjectionBaseClass<EnrichmentType, ProjectionOptions>
```

## Parameters

- `config` (ModelProjectionBaseConfig<EnrichmentType, TsIdentifierType, ProjectionOptions>, required)
  - `id` (string, required)
  - `toIdentifierName` ((args: ToModelIdentifierNameArgs<EnrichmentType, ProjectionOptions>) => string, required): Pure: the cache-key name. With no projection options, `toModelContentSettings` asks for it once in a run and keeps it.
  - `toIdentifierType` ((ref: RefParts, context: GenerateContextType) => TsIdentifierType, required): Context-aware, overridable: the non-`name` parts of the identifier (`type` / `typeName` / `exported`), derived from the schema. Runs only on cache-miss. Returns `IdType` - the veneer's `XxIdentifierType`, whose `type` is bound to that language's `EntityType` vocabulary (the loose `string` by default). The tightening rides the type argument.
  - `toExportPath` ((args: ToModelExportPathArgs<EnrichmentType, ProjectionOptions>) => string, required)
  - `toEnrichmentDefaults` ((args: ToEnrichmentsArgs) => EnrichmentType | undefined): Optional: compute the DEFAULT enrichment values for a model from its schema - the seed the CMS persists and the user then edits (vs the entry's `toEnrichments`, which READS already-authored values). Returns the `{ subject, generator, stack }` umbrella; a generator typically fills only `subject` and leaves the run-constant `generator` / `stack` scopes `undefined`. Omitted → the derived static returns `undefined`.

## Returns

`TsModelProjectionBaseClass<EnrichmentType, ProjectionOptions>`
