Skip to content

createSchema

Generated reference page for the createSchema function export.

Signatures

ts
function createSchema(kind: "string" | "number" | "boolean" | "enum" | "array" | "custom", overrides?: FlagSchemaOverrides): FlagSchema;
ParameterTypeDescription
kind"string" | "number" | "boolean" | "enum" | "array" | "custom"Discriminator for the value type this flag accepts.
overridesFlagSchemaOverrides | undefinedPartial FlagSchema fields merged onto defaults.

Members

Members

createSchema

Create a raw FlagSchema object with sensible defaults.

Most consumers should prefer the higher-level flag factory, which returns an immutable FlagBuilder with type inference and safe modifier chaining. createSchema() is the low-level escape hatch for advanced schema composition, tests, or custom factories that need to work directly with the runtime descriptor.

overrides are shallow-merged on top of the default shape, so callers are responsible for keeping the resulting schema internally consistent.

ts
(kind: "string" | "number" | "boolean" | "enum" | "array" | "custom", overrides?: FlagSchemaOverrides): FlagSchema;

Examples

ts
const schema = createSchema('enum', {
  enumValues: ['us', 'eu', 'ap'],
  description: 'Deployment region',
});

See Also

Released under the MIT License.