mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-15 09:12:24 +02:00
refactor: unify how validateOptions is handled (#6961)
* refactor: unify how validateOptions is handled * fix types * fix again
This commit is contained in:
parent
44107fb879
commit
6e2eb44964
43 changed files with 542 additions and 540 deletions
|
@ -6,7 +6,10 @@
|
|||
*/
|
||||
|
||||
import {Joi} from '@docusaurus/utils-validation';
|
||||
import type {ThemeConfig, Validate, ValidationResult} from '@docusaurus/types';
|
||||
import type {
|
||||
ThemeConfig,
|
||||
ThemeConfigValidationContext,
|
||||
} from '@docusaurus/types';
|
||||
|
||||
export const DEFAULT_CONFIG = {
|
||||
// enabled by default, as it makes sense in most cases
|
||||
|
@ -45,9 +48,6 @@ export const Schema = Joi.object({
|
|||
export function validateThemeConfig({
|
||||
validate,
|
||||
themeConfig,
|
||||
}: {
|
||||
validate: Validate<ThemeConfig>;
|
||||
themeConfig: ThemeConfig;
|
||||
}): ValidationResult<ThemeConfig> {
|
||||
}: ThemeConfigValidationContext<ThemeConfig>): ThemeConfig {
|
||||
return validate(Schema, themeConfig);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue