Object

Object

Defines an object schema.

Parameters

schema: Record<string, Schema>

Example

const objectSchema = Config.object({
  foo: Config.string(),
  nested: Config.object({
    bar: Config.boolean().required(),
  }),
});
 
/*
{
  foo: string | undefined,
  nested: {
    bar: boolean;
  }
}
*/

Caution: Inner schema coercion is false by default!

Coercion

Coercion is disabled for object.