Skip to content

Instantly share code, notes, and snippets.

View peakh's full-sized avatar
🍉

Noah peakh

🍉
View GitHub Profile
@peakh
peakh / fetch.ts
Created August 17, 2025 01:56
A fetch function in TypeScript with a type parameter for proper typing.
export default async function strictFetch<T>(url: string, options?: RequestInit): Promise<T> {
const res = await fetch(url, options);
const json = await res.json() as T;
return json;
}
@peakh
peakh / example.md
Last active March 5, 2025 23:04
Discord-supported codeblock languages in one interface in TypeScript.

Send the code block within a Discord channel:

import languages from "./languages";
import { codeBlock } from "discord.js";

return await interaction.reply({
	content: codeBlock(languages.Python, "Hello World!"),
	ephemeral: true
});