From ef06f87ba5f034dc9920e9075b80d39b891a3059 Mon Sep 17 00:00:00 2001 From: George Mandis Date: Sun, 28 Nov 2021 01:22:45 -0800 Subject: [PATCH] Cleaned up types --- src/@types/bubo.d.ts | 7 +------ src/index.ts | 4 ++-- src/renderer.ts | 4 ++-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/@types/bubo.d.ts b/src/@types/bubo.d.ts index a9c8452..040b51b 100644 --- a/src/@types/bubo.d.ts +++ b/src/@types/bubo.d.ts @@ -1,11 +1,6 @@ -export interface ContentFromAllFeeds { +export interface Feeds { [key: string]: object[] } - -export interface Feeds { - [key: string]: FeedItem -} - export interface FeedItem { [key: string]: string | number | Date | FeedItem[]; items: FeedItem[] diff --git a/src/index.ts b/src/index.ts index 59fccc9..4184c37 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,7 +12,7 @@ import fetch from "node-fetch"; import Parser from "rss-parser"; -import { ContentFromAllFeeds, FeedItem } from "./@types/bubo"; +import { Feeds, FeedItem } from "./@types/bubo"; import { render } from "./renderer.js"; import { getLink, getTitle, getTimestamp, parseFeed, getFeedList } from "./utilities.js"; @@ -20,7 +20,7 @@ const DEBUG = false; const parser = new Parser(); const feedList = await getFeedList(); -const contentFromAllFeeds: ContentFromAllFeeds = {}; +const contentFromAllFeeds: Feeds = {}; const errors = []; for (const [group, feeds] of Object.entries(feedList)) { diff --git a/src/renderer.ts b/src/renderer.ts index d2714f0..d0eb910 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -7,7 +7,7 @@ import nunjucks from "nunjucks"; const env: nunjucks.Environment = nunjucks.configure({ autoescape: true }); import { readFile } from "fs/promises"; -import { ContentFromAllFeeds } from "./@types/bubo"; +import { Feeds } from "./@types/bubo"; /** * Global filters for my Nunjucks templates @@ -26,7 +26,7 @@ const template: string = )).toString(); // generate the static HTML output from our template renderer -const render = ({ data, errors }: { data: ContentFromAllFeeds; errors: unknown[] }) => { +const render = ({ data, errors }: { data: Feeds; errors: unknown[] }) => { return env.renderString(template, { data, errors