Skip to content

@pumpkin-plugins/config API / fields / Field

Interface: Field<T> ​

Defined in: tools/config/src/fields.ts:11

One setting: how to read it, write it and document it. T includes undefined for optional settings, which have no default.

Type Parameters ​

T ​

T

Properties ​

default ​

readonly default: T

Defined in: tools/config/src/fields.ts:17

Value used when the setting is absent. undefined makes the setting optional.


description ​

readonly description: string

Defined in: tools/config/src/fields.ts:15

What the setting does. Becomes the comment above it in the file and a row in the docs.


example ​

readonly example: string

Defined in: tools/config/src/fields.ts:21

A TOML literal shown in the commented example of an unset optional setting.


expected ​

readonly expected: string

Defined in: tools/config/src/fields.ts:19

What a valid value looks like, used in warnings: must be <expected>.


migrateFrom? ​

readonly optional migrateFrom?: readonly string[]

Defined in: tools/config/src/fields.ts:23

Path to an older setting whose value should seed this setting when it is absent.


type ​

readonly type: FieldType

Defined in: tools/config/src/fields.ts:13

Type name shown in the generated documentation.

Methods ​

format() ​

format(value): string

Defined in: tools/config/src/fields.ts:27

Writes a value as a TOML literal.

Parameters ​

value ​

Exclude<T, undefined>

Returns ​

string


parse() ​

parse(raw): Parsed<Exclude<T, undefined>>

Defined in: tools/config/src/fields.ts:25

Validates a raw TOML value.

Parameters ​

raw ​

unknown

Returns ​

Parsed<Exclude<T, undefined>>

Pumpkin Plugins documentation