Explain TypeScript code
Paste TypeScript, generics and all, and Vibe explains what the code does and what its types are telling you.
Up to 1,500 characters (about 60 lines). Your code is sent to Unvibe and Anthropic to write the explanation. Don't paste keys or passwords. Common key formats are refused.
Vibe24 lines selected
Press Explain it for the sample, or paste your own code first.
What this TypeScript sample shows
- generics
Result<T>andgetJson<T>work for any shape of data.getJson<User>fills inTasUser, soresult.valueis typed as aUser.- type narrowing
Resultis a union of two object types told apart byok. Afterif (!result.ok) return ..., TypeScript knows only the{ ok: true; value: T }case is left, so readingresult.valuecompiles.- async/await
- Both functions are
async, so they return aPromise.awaitwaits for the response, and then for its body, before the next line runs. - modules
exportmakes the two functions importable from other files.ResultandUserare not exported, so they stay private to this file.
Good to know
as Tis a promise to the compiler, not a check. If the server sends a different shape, nothing fails until a later line uses a missing field. Validate data that comes from outside your code.email?: stringmeans the field may be missing, so its type isstring | undefined. The ternary inuserLabelhandles both cases.- With
stricton, acatchvariable has the typeunknown, so the code checkserr instanceof Errorbefore readingerr.message.
Watch out: getJson never throws: every failure becomes { ok: false }. A caller that reads .value without checking ok first gets a compile error, which is the point of the pattern.
Explain TypeScript code beside your editor
Unvibe is a free app for Mac and Windows. In the app there is no pasting: select code in any app and press Control+U (Ctrl+Alt+U on Windows).
Install on Mac
curl -fsSL https://unvibe.site/install.sh | bashPaste into Terminal. Unvibe isn't notarized by Apple yet, so this is the smooth path.
Or download the .dmg · Intel Mac build · SHA-256 checksums
No install warning? Use Unvibe in your browser
Opening the .dmg the first time
- Open the .dmg and drag Unvibe to Applications.
- Open it once; macOS says it can't verify it. Click Done.

Real screen, macOS 15 - System Settings › Privacy & Security › Open Anyway. Confirm, then enter your Mac password. The button shows for about an hour after you try to open Unvibe.

Real screen, macOS 15
The Terminal line checks the download against the published SHA-256 and Unvibe's self-signed signature before it installs anything. More help with the first open