---
title: Astro is hard....
description: Arugh
pubDate: 2024-05-28
tags:
  - astro
  - typescript
---

import Note from "../../components/Note.astro";

<Note text="I have no clue what I'm doing :3" />

- I've been trying to learn typescript through trying astro
- Astro is hard, due to all the issues I've encountered

```typescript
export async function getTagsBySlug(postTags: string[]): Promise<CollectionEntry<"tags">[]> {
    // Collect all the tags from collections
    const allTags: CollectionEntry<"tags">[] = await getCollection("tags");
    
    // Loop through all the tags in a post and the tags in the collections
    // To see if they match, if they do we'll return them
    const tags: CollectionEntry<"tags">[] = [];
    postTags.forEach((postTag) => {
        allTags.forEach((allTag) => {
            if (allTag.slug === postTag) tags.push(allTag);
        });
    });
    
    // Yeet
    return tags;
}
```
