Files and imports

FUNCTION

register

@skmtc/lang-typescript 0.19.1

TypeScript's register function - the single implementation behind TsSnippet.register and the projection-base veneers.

Converts the concise import form into TsImport objects, creates the destination TsFile on first write (caller-side creation - the language is right here), and hands pure data to the neutral context.register. No generatorId, no Lang object: the language is this module.

Signature

import { register } from '@skmtc/lang-typescript'

register(
  context: GenerateContextType,
  args: TsRegisterArgs & { destinationPath: string }
): void

Parameters

context, GenerateContextType required
args, TsRegisterArgs & { destinationPath: string } required
imports, Record<string, ImportNameArg[]>

Import statements to include, keyed by module. A key spelled from the workspace root (@/, ./, /, or a Windows form) is an export path and is written in its one spelling; any other key (zod, @tanstack/query, types/y.ts) is a module specifier, written as it is.

reExports, Record<string, TsIdentifier[]>

Re-export statements to include, organized by source module path.

definitions, (DefinitionBase | undefined)[]

Definition objects to include in the destination file.

custom, Stringable

Free-form content for the destination file's neutral custom slot (FileBase.custom) - typically a leading file banner comment (e.g. a codegen header). Forwarded to context.register; the last non-undefined write wins.

destinationPath, string required

Returns

void