mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-31 01:47:17 +02:00
improve type
This commit is contained in:
parent
a9d6bcf968
commit
91aa292d26
2 changed files with 2 additions and 6 deletions
|
@ -87,10 +87,8 @@ export default function pluginContentShowcase(
|
|||
);
|
||||
|
||||
const sourcePath = path.join(contentPath, relativeSource);
|
||||
|
||||
const data = await fs.readFile(sourcePath, 'utf-8');
|
||||
// todo remove as ... because bad practice ?
|
||||
const unsafeData = Yaml.load(data) as {[key: string]: unknown};
|
||||
const unsafeData = Yaml.load(data);
|
||||
const showcaseItem = validateShowcaseItem(unsafeData);
|
||||
|
||||
validateFrontMatterTags(showcaseItem.tags, createdTagSchema);
|
||||
|
|
|
@ -17,9 +17,7 @@ const showcaseItemSchema = Joi.object({
|
|||
tags: Joi.array().items(Joi.string()).required(),
|
||||
});
|
||||
|
||||
export function validateShowcaseItem(frontMatter: {
|
||||
[key: string]: unknown;
|
||||
}): ShowcaseItem {
|
||||
export function validateShowcaseItem(frontMatter: unknown): ShowcaseItem {
|
||||
return validateFrontMatter(frontMatter, showcaseItemSchema);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue