Files and imports

FUNCTION

defineAndRegister

@skmtc/lang-typescript 0.19.1

Build a TsDefinition from value and register it at destinationPath. The transform-level counterpart of this.defineAndRegister - a transform (a closure with no class) imports this directly; the language comes from the import, like everything else.

No cache check - callers wrap with context.findDefinition first where dedup is wanted (see the gen-msw accumulator pattern).

Signature

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

defineAndRegister<Value extends GeneratedValue>(
  context: GenerateContextType,
  args: TsDefineAndRegisterArgs<Value>
): TsDefinition<Value>

Parameters

context, GenerateContextType required
args, TsDefineAndRegisterArgs<Value> required
identifier, TsIdentifier required
value, Value required
destinationPath, string required
description, string

JSDoc description rendered above the declaration.

leadingComment, string

A // line comment rendered verbatim above the declaration (see TsDefinition).

noExport, boolean

Returns