Skip to content

@graphty/graphty-element / config / parseOptions

Function: parseOptions() ​

parseOptions<S>(optionsSchema, options): InferOptions<S>

Defined in: graphty-element/src/config/OptionsSchema.ts:126

Validate and parse options using the schema

Uses Zod for validation, applying defaults from the schema. Throws ZodError if validation fails.

Type Parameters ​

S ​

S extends OptionsSchema

Parameters ​

optionsSchema ​

S

Options schema to validate against

options ​

PartialOptions<S>

Partial options to parse and validate

Returns ​

InferOptions<S>

Fully typed options with defaults applied

Example ​

typescript
const options = parseOptions(myOptionsSchema, { dampingFactor: 0.9 });
// options is fully typed with all defaults applied