Skip to content

Instantly share code, notes, and snippets.

View t3dotgg's full-sized avatar

Theo Browne t3dotgg

View GitHub Profile
@KATT
KATT / favourite-ts-tricks.md
Last active July 26, 2023 06:16
🧙‍♂️ Favourite non-obvious TS tricks

Record<string, x | undefined>

Represent maps

// rather than 
const map: {[ key: string ]: string} = {
  foo: 'bar',
}
@chuckxD
chuckxD / __HEY.md
Last active August 24, 2024 03:48
ffz/bttv known API end-points quick list
@t3dotgg
t3dotgg / proposal.jsx
Created July 12, 2021 00:25
A proposal for a `useBackend` React hook that is compiled out into an API route. Inspired by Vercel and Next.js
// /pages/index.tsx
function ExamplePage() {
const { data } = useBackend(
"get-user-info",
async () => {
const data = await getProfileFromDB();
return data; // {name: string}
},
{ prefetch: true }