Skip to content

PolicyFactory

PolicyFactory<TConfig> = RequiredKeys<TConfig> extends never ? (config?) => Policy : (config) => Policy

Defined in: src/policies/sdk/define-policy.ts:167

Conditional policy factory type.

When TConfig has at least one required key, the factory requires a config argument. When all keys are optional (or TConfig is the base PolicyConfig), config is optional.

This closes the gap between “type-safe config” and the runtime validate callback - the editor catches missing required fields at compile time.

TConfig extends PolicyConfig