Skip to content

Instantly share code, notes, and snippets.

View Harshkumar77's full-sized avatar
🎯
Focusing

Harsh Kumar Harshkumar77

🎯
Focusing
View GitHub Profile
@Harshkumar77
Harshkumar77 / declaration.md
Last active February 23, 2024 08:52
Declaration

Personal Project declaration

  • This project is just build as hobby project
  • The data won't be shared to third party, we maintain full privacy
  • Don't use this project for your business without consent of author
@Harshkumar77
Harshkumar77 / index.ts
Last active August 8, 2023 15:07
How to fetch in Typescript like pro ?
import { RandomUserAPIResponse, User } from "./types"
async function fetchRandomUser() {
try {
const response = await fetch('https://randomuser.me/api/')
const randomUser = await response.json() as RandomUserAPIResponse
return { user: randomUser.results[0] } as { success: true, user: User }