Metadata that describes how (and whether) a given property should be serialized and deserialized.

interface PropertyDef<T> {
    default?: T;
    deserialize?: false | ((config: T) => void | Promise<void>);
    isDefault?: ((value: T, serializeMode: SerializeMode) => boolean);
    serialize?: false | ((mode?: SerializeMode) => T);
    serializeModes?: PropertyDefSerializeMode[];
}

Type Parameters

  • T

Properties

default?: T

The default value of the property. This is used to prevent unnecessary config from making its way into an exported json file.

deserialize?: false | ((config: T) => void | Promise<void>)

A function that deserializes configuration into the property. Setting this to false will disable deserialization for this property.

isDefault?: ((value: T, serializeMode: SerializeMode) => boolean)

A function that takes in a serialized value of the property and returns a boolean depicting whether or not the value is equivalent to the property's default value. This is used to prevent unnecessary config from making its way into an exported json file.

serialize?: false | ((mode?: SerializeMode) => T)

A function that serializes the property into configuration. Setting this to false will disable serialization for this property.

serializeModes?: PropertyDefSerializeMode[]

The flag values that will cause the property to serialize.