Skip to content

Function: configItem()

ts
function configItem<T>(options): ConfigItem<T>;

Defined in: packages/core/src/schema.ts:109

Creates a type-safe configuration item. This helper provides better type inference and makes the schema more readable.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
optionsConfigItem<T>Configuration item definition including default, validator, description, and example.

Returns

ConfigItem<T>

The same options object, typed as ConfigItem.

Example

typescript
const port = configItem({
  default: 3000,
  validator: z.number().int().min(0).max(65535),
  description: 'Server port',
  example: 8080
});