refactor: remove a lot of implicit anys (#7468)

This commit is contained in:
Joshua Chen 2022-05-23 15:40:53 +08:00 committed by GitHub
parent 0c8e57de67
commit 3666a2ede5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 148 additions and 163 deletions

View file

@ -9,7 +9,10 @@ import {validateThemeConfig, DEFAULT_CONFIG} from '../validateThemeConfig';
import type {Joi} from '@docusaurus/utils-validation';
function testValidateThemeConfig(themeConfig: {[key: string]: unknown}) {
function validate(schema: Joi.Schema, cfg: {[key: string]: unknown}) {
function validate(
schema: Joi.ObjectSchema<{[key: string]: unknown}>,
cfg: {[key: string]: unknown},
) {
const {value, error} = schema.validate(cfg, {
convert: false,
});

View file

@ -237,10 +237,14 @@ function SearchPageContent(): JSX.Element {
url,
_highlightResult: {hierarchy},
_snippetResult: snippet = {},
}: {
url: string;
_highlightResult: {hierarchy: {[key: string]: {value: string}}};
_snippetResult: {content?: {value: string}};
}) => {
const parsedURL = new URL(url);
const titles = Object.keys(hierarchy).map((key) =>
sanitizeValue(hierarchy[key].value),
sanitizeValue(hierarchy[key]!.value),
);
return {