Removed unnecessary types and fixed some bugs

This commit is contained in:
Firq-ow 2024-01-09 17:01:31 +01:00
parent 441d8a42a3
commit 62e3869ce9
Signed by: Firq
GPG key ID: BC5CE35A72BDB4AB
8 changed files with 16 additions and 46 deletions
src/utils

View file

@ -1,16 +1,14 @@
import { getEntry } from 'astro:content'
import type { GlobImage, ImportRecord } from '../types/generic'
export function plsLoadImage(
record: Record<string, () => Promise<{ default: ImageMetadata }>>,
path: string
) {
export function plsLoadImage(record: ImportRecord<GlobImage>, path: string) {
const loadedImage = record[path]?.()
if (!loadedImage) throw new Error('Asset was not found:' + path)
if (!loadedImage) throw new Error(`Asset was not found for path ${path}`)
return loadedImage
}
export async function plsLoadTAEntry(key: string) {
const filecontent = (await getEntry('taInfoData', key))?.data
if (!filecontent) throw new Error(`Datafile ${key} is missing!`)
if (!filecontent) throw new Error(`Datafile was not found for key ${key}`)
return filecontent
}