@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
readonlydefault:T
Defined in: tools/config/src/fields.ts:17
Value used when the setting is absent. undefined makes the setting optional.
description
readonlydescription: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
readonlyexample:string
Defined in: tools/config/src/fields.ts:21
A TOML literal shown in the commented example of an unset optional setting.
expected
readonlyexpected:string
Defined in: tools/config/src/fields.ts:19
What a valid value looks like, used in warnings: must be <expected>.
migrateFrom?
readonlyoptionalmigrateFrom?: readonlystring[]
Defined in: tools/config/src/fields.ts:23
Path to an older setting whose value should seed this setting when it is absent.
type
readonlytype: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>>