Share TypeScript snippets, type definitions, or utility functions: syntax-highlighted, encrypted, and shareable without an account.
1type Result<T, E = Error> =2 | { ok: true; value: T }3 | { ok: false; error: E };45async function fetchJson<T>(url: string): Promise<Result<T>> {6 try {7 const res = await fetch(url);8 if (!res.ok) throw new Error(`HTTP ${res.status}: ${res.statusText}`);9 const value = (await res.json()) as T;10 return { ok: true, value };11 } catch (error) {12 return { ok: false, error: error as Error };13 }14}1516// Usage17const result = await fetchJson<{ users: User[] }>("/api/users");18if (result.ok) {19 console.log(result.value.users);20}Paste TypeScript code and get a shareable link with full syntax highlighting, server-side rendered with no JavaScript overhead.
Deleted on first open. Can't be viewed twice.
Add a password for end-to-end encryption with no raw key stored.
Set pastes to expire after 1 hour, 1 day, 7 days, or up to 30 days. Gone when you say so.
No sign-up, no email, no ads. Paste and share in seconds.
Yes. Select TypeScript as the language: Shiki's TypeScript grammar includes full JSX/TSX support, so React component code highlights correctly.
Pastes are capped at 5 MB, plenty for any single file or snippet.
Yes. Set an expiry from 1 hour to 30 days when creating a paste. After expiry the paste is permanently deleted from the server.