chore: Add return type

Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
This commit is contained in:
Tim Hårek Andreassen 2024-03-30 13:02:08 +01:00
parent 543c40207c
commit f4ec8f8d36
No known key found for this signature in database
GPG Key ID: E59C7734F0E10EB5
1 changed files with 7 additions and 3 deletions

View File

@ -2,11 +2,15 @@ import { FreshContext } from "$fresh/server.ts";
import { parse, toSeconds } from "https://esm.sh/iso8601-duration@2.1.1"; import { parse, toSeconds } from "https://esm.sh/iso8601-duration@2.1.1";
import { nrkRadio, OriginalEpisode } from "../../../../../lib/nrk.ts"; import { nrkRadio, OriginalEpisode } from "../../../../../lib/nrk.ts";
// TODO: This type `OriginalEpisode` is missing stuff. type Chapter = {
function toChapters(episode: OriginalEpisode) { title: string | undefined;
startTime: number | undefined;
};
function toChapters(episode: OriginalEpisode): Chapter[] {
return episode.indexPoints.map((indexPoint) => ({ return episode.indexPoints.map((indexPoint) => ({
title: indexPoint.title, title: indexPoint.title,
startTime: toSeconds(parse(indexPoint.startPoint)), startTime: indexPoint.startPoint ? toSeconds(parse(indexPoint.startPoint)) : undefined,
})); }));
} }