type error hotfixes

This commit is contained in:
Paul W. 2022-04-24 00:40:26 -04:00
parent d189096e96
commit 24a76f8f7c
3 changed files with 5 additions and 3 deletions

View File

@ -17,7 +17,9 @@ function FuzzyBar(): JSX.Element {
let entries = [...pages];
for (const [k,v] of posts.entries()) {
entries.push({title: v.title, link: `posts/${v.slug}`});
const item = v as any;
if (item.title && item.slug)
entries.push({title: item.title, link: `posts/${item.slug}`});
}
try {

View File

@ -11,7 +11,7 @@ module.exports = {
config.plugins.push(
{
apply: (compiler) => {
compiler.hooks.initialize.tap('cachePostLinkDataInit', _ => {
compiler.hooks.beforeCompile.tap('cachePostLinkDataInit', _ => {
cachePostLinkData();
});
}

View File

@ -5,7 +5,7 @@ import Posts from '../../public/posts.json';
import prettyDatePrint from '../../util/pretty-date';
function HomePage({posts}: any) {
Posts.sort((x, y) => { return x.title.localeCompare(y.title) });
Posts.sort((x, y) => { return (x as any).title.localeCompare((x as any).title) });
// todo: create a table-like interface
return (
<Layout name='Posts'>