Creates a function to validate an user configuration object
type of input config
type of config after parsing
the default configuration
Optional
function used to parse/validate the configuration
type MyConfig = { value: number; label?: string;};const getConfig<MyConfig>({ value: 1, label: 'Title',}, { value(value, { defValue }) { return value < 10 ? value : defValue; }});const config = getConfig({ value: 3 }); Copy
type MyConfig = { value: number; label?: string;};const getConfig<MyConfig>({ value: 1, label: 'Title',}, { value(value, { defValue }) { return value < 10 ? value : defValue; }});const config = getConfig({ value: 3 });
Creates a function to validate an user configuration object