Skip to content

setConfigValue

setConfigValue<T>(config, key, value): T

Set a dotted path, returning a new document. Non-mutating and creating any intermediate objects, so set works on an empty file.

The key must be a known setting and the value must match its type; both throw ConfigError rather than writing something that will fail to load next time, as does an existing intermediate value that is not an object. The generic return means a raw record edits to a raw record with its unknown keys untouched.

Type Parameter
T extends object
ParameterType
configT
keystring
valueunknown

T