UNPKG

1.44 kBTypeScriptView Raw
1import * as t from "io-ts";
2import { AutoRc } from "./types";
3import { AsyncSeriesBailHook } from "tapable";
4interface ConfigOptionError {
5 /** Key path in config to misconfigured option */
6 path: string;
7 /** The expected type */
8 expectedType: string;
9 /** The actual value */
10 value: any;
11}
12export declare type ConfigError = string | ConfigOptionError;
13/** Format and error as a string */
14export declare function formatError(error: ConfigError): string;
15export declare type ValidatePluginHook = AsyncSeriesBailHook<[string, any], void | ConfigError[]>;
16/** Ensure plugins validation is correct. */
17export declare function validatePlugins(validatePlugin: ValidatePluginHook, rc: AutoRc): Promise<ConfigError[]>;
18/** Create a function to validation a configuration based on the configDeceleration */
19export declare const validateIoConfiguration: (name: string, configDeceleration: t.Any | t.HasProps) => (rc: unknown) => Promise<Array<ConfigError | string>>;
20export declare const validateAutoRc: (rc: unknown) => Promise<Array<ConfigError | string>>;
21/** Validate a plugin's configuration. */
22export declare function validatePluginConfiguration(name: string, pluginDefinition: t.Any | t.HasProps, providedOptions: unknown): Promise<(string | {
23 path: string;
24 /** The expected type */
25 expectedType: string;
26 /** The actual value */
27 value: any;
28})[]>;
29export {};
30//# sourceMappingURL=validate-config.d.ts.map
\No newline at end of file