import { DeclarationOption } from 'typedoc'; import { MapperPart } from './option'; import { DeclarationOptionConfig, ParameterValueType, TypeErr } from './utils'; import type { ABasePlugin } from '../base-plugin'; interface Builder, TDecs extends Record> { add: , TDec extends DeclarationOptionConfig>(name: K, declaration: TDec, ...mapper: MapperPart) => Builder; build: [Exclude] extends [never] ? TDecs extends Record ? () => OptionGroup : TypeErr<['Invalid case']> : TypeErr<['Missing declarations for keys', Exclude]>; } type OptionGroupSetValue> = { [k in keyof TDeclarations]?: ParameterValueType; }; export declare class OptionGroup, TDeclarations extends { [k in keyof T]: DeclarationOptionConfig; } = { [k in keyof T]: DeclarationOptionConfig; }> { readonly plugin: ABasePlugin; private readonly _options; /** * Generate a type-helper factory to constraint the option to be of the given {@link T2 type}. * * TODO: change signature once https://github.com/microsoft/TypeScript/pull/26349 is merged. * * @param plugin - The plugin declaring the option. * @returns a builder to use in order to generate the full option group. */ static factory>(plugin: ABasePlugin): Builder>; /** * Create the actual option builder. * * @param plugin - The plugin declaring the option. * @param decs - The declarations so far. * @param mappers - The mappers so far. * @returns the builder to chain. */ private static _build; private get _rootOption(); constructor(plugin: ABasePlugin, optionDeclarations: TDeclarations, mappers: { [k in keyof T]: (v: any) => T[k]; }); /** * Get the mapped values. * * @returns the group values. */ getValue(): T; /** * Set the raw values. * * @param value - The value to set. Paths, JSON & partial options are authorized */ setValue(value: OptionGroupSetValue | string): void; setValue(key: TK, value: ParameterValueType): void; setValue(...args: [OptionGroupSetValue | string] | [key: keyof TDeclarations, value: ParameterValueType]): void; /** * Set the raw values. * * @param value - The value to set. Paths, JSON & partial options are authorized. * @returns nothing. */ private _setValue; /** * Set the raw values from a POJO. * * @param value - The values to set as object. */ private _setValueFromObject; /** * Load the given file as being the full plugin options. * * @param filename - The file containing options. Any `require`able file can be provided. */ private _setValueFromFile; /** * Try loading different options sources, and update plugin options with default values if not set. */ private _onBeforeOptionsFreeze; /** * Execute a {@link cb callback} on each declared options, & return an object containing the resulting values. * * @param cb - The function to execute on each option. Called with the key & the {@link Option}. * @returns the mapped values. */ private _mapOptions; } export {}; //# sourceMappingURL=option-group.d.ts.map