>_MochiKit
⌘KSubscribe
Featured · JavaScript

TypeScript vs JavaScript: When Types Earn Their Keep

Types cost keystrokes and buy confidence. A practical guide to when that trade pays off — and when plain JS wins.

By Sam Iyer·JavaScript·4 min read

Read the feature →

TypeScript vs JavaScript: When Types Earn Their Keep
A code editor mid-refactor — where types quietly earn their keep.

Signature

Which one when

pick by constraint, not hype
ReactvsSvelte
React is best at

Huge ecosystem, hiring, and battle-tested patterns.

Svelte is best at

Less code, no virtual DOM, delightful for smaller apps.

Which one whenTeam & ecosystem → React. Bundle size & joy → Svelte.

RESTvsGraphQL
REST is best at

Simple, cacheable, everyone knows it.

GraphQL is best at

One request, exactly the data you asked for.

Which one whenPublic/simple API → REST. Complex, client-driven data → GraphQL.

NodevsBun
Node is best at

Boring, stable, runs everything.

Bun is best at

Fast startup, batteries included, modern defaults.

Which one whenProduction today → Node. Greenfield speed → Bun.

JavaScriptvsTypeScript
JavaScript is best at

Zero setup, fast to prototype.

TypeScript is best at

Types catch bugs before they run; scales with the team.

Which one whenTiny script → JS. Anything that grows → TS.


Signature · real code

Snippets that actually compile

Every code block on MochiKit is real, correct TypeScript or JavaScript — syntax-highlighted, runnable-looking, and pulled straight from the article it illustrates. No pseudo-code, no gibberish.

greet.ts
function greet(user: User): string {
  return `Hello, ${user.profile.displayName}`;
}

// The compiler knows the shape — a typo here
// never survives the build.
const msg = greet(currentUser);

{ }
About the name

Standing on the shoulders of MochiKit

MochiKit was a well-loved JavaScript library from the mid-2000s — 'MochiKit makes JavaScript suck less' was the tagline — that helped a generation write friendlier front-end code. This blog carries the name forward as a tribute; it isn't the original library or its documentation, just a place that shares its love of good JavaScript.

Read the full story →

On the critical path

Build partners

the tools that keep MochiKit shipping

Also in the toolchain

Tools and teams we learn from.