Skip to main content

Function: defineGenerator()

Call Signature​

function defineGenerator<S, D>(driver): GeneratorDriverBase<S> & {
dependsOn?: DependencyList<D>;
};

Defined in: packages/config/src/define-driver.ts:62

Private generator dependencies are declared as descriptors (a config entry without namespaces): dependsOn: [{ use: zodGenerator, options: { … } }]. The function form, dependsOn: (options) => [ … ], receives this generator's validated options (schema Output), so the dependency's options can derive from them. Each descriptor's options is checked against the dependency's schema.

The two forms are separate overloads: with a single union-typed dependsOn, TypeScript does not infer the descriptor list from the function's return.

Type Parameters​

Type ParameterDefault type
S extends GenericSchema<unknown, unknown> | undefinedundefined
D extends DependencyShapereadonly []

Parameters​

ParameterType
driverGeneratorDriverBase<S> & { dependsOn?: DependencyList<D>; }

Returns​

GeneratorDriverBase<S> & { dependsOn?: DependencyList<D>; }

Call Signature​

function defineGenerator<S, D>(driver): GeneratorDriverBase<S> & {
dependsOn?: (options) => DependencyList<D>;
};

Defined in: packages/config/src/define-driver.ts:68

Private generator dependencies are declared as descriptors (a config entry without namespaces): dependsOn: [{ use: zodGenerator, options: { … } }]. The function form, dependsOn: (options) => [ … ], receives this generator's validated options (schema Output), so the dependency's options can derive from them. Each descriptor's options is checked against the dependency's schema.

The two forms are separate overloads: with a single union-typed dependsOn, TypeScript does not infer the descriptor list from the function's return.

Type Parameters​

Type ParameterDefault type
S extends GenericSchema<unknown, unknown> | undefinedundefined
D extends DependencyShapereadonly []

Parameters​

ParameterType
driverGeneratorDriverBase<S> & { dependsOn?: (options) => DependencyList<D>; }

Returns​

GeneratorDriverBase<S> & { dependsOn?: (options) => DependencyList<D>; }