Blog
Posts on software development, careers, and craft.
TypeScript types can be intimidating to read
TypeScript types can be intimidating to read. My solution? Break it into pieces. This is a preview of my upcoming new course, "TypeScript: Deep Div...
Here's how I validate a URL param via Zod
Here's how I validate a URL param via Zod. I'm sharing more details on how I use Zod including validating APIs, localStorage, etc in "TypeScript: D...
The fact that so many apps out there blindly trust runtime inputs is the...
The fact that so many apps out there blindly trust runtime inputs is the source of countless bugs and security vulnerabilities. NEVER trust the cli...
I validate all my runtime inputs: -Cookies -Local storage -URL params -API...
I validate all my runtime inputs: -Cookies -Local storage -URL params -API responses -Form values -Environment variables I use Zod to validate runt...
Claim: "Those who can't do, teach"
Claim: "Those who can't do, teach". Reality: "To go deeper, teach." For example, I've worked successfully in TypeScript for years. But now that I'm...
I'm reviewing a TypeScript codebase that's filled with type assertions like this
I'm reviewing a TypeScript codebase that's filled with type assertions like this. return fieldErrors as { [key: string]: { errors: string[] } } Typ...
There are many JS runtimes - Node, Deno, Bun, etc
There are many JS runtimes - Node, Deno, Bun, etc. Just learned about a new one: Bare. Bare is unique: - Light (so can run on mobile) - No server r...
Zod is TypeScript's most popular runtime validation library
Zod is TypeScript's most popular runtime validation library. But, I just tried ArkType, and it's compelling. Here's why: - Simpler, TS-like API - 1...
So Dan Abramov's new *giant* blog post (think small book) is worth the read
So Dan Abramov's new *giant* blog post (think small book) is worth the read. I admire how Dan encourages thinking in first principles. If you haven...
One of my favorite tools during a code audit is jscpd
One of my favorite tools during a code audit is jscpd. It detects copy/pasted code. In a codebase I’m currently reviewing, nearly half of the JS is...
Problem: Manually creating TypeScript types is time-consuming, tedious, and...
Problem: Manually creating TypeScript types is time-consuming, tedious, and error prone. Solution: Generate the types if you can. Here are 4 exampl...
TypeScript has around 20 handy utility types - Pick, Omit, Partial, etc
TypeScript has around 20 handy utility types - Pick, Omit, Partial, etc. But there are 100's handy of third-party utility types too. Here are the t...
Just generated Playwright tests for a feature that had no tests with this...
Just generated Playwright tests for a feature that had no tests with this 2-step LLM workflow: 1. ChatGPT prompt: "Create a requirements document i...
React Server Components have gotten a lot of hate recently
React Server Components have gotten a lot of hate recently. I'm not saying they're perfect, but this short comparison shows why I still think they'...
The biggest reason I prefer working in TypeScript over typed alternatives...
The biggest reason I prefer working in TypeScript over typed alternatives like C# or Java: Bare functions. In C# and Java, everything has to be a c...
I've heard people say "spelling mistakes in code are harmless"
I've heard people say "spelling mistakes in code are harmless". I disagree. Spelling mistakes slow reading, create confusion, and can lead to bugs....
PSA 📢: This isn’t error handling
PSA 📢: This isn’t error handling. .catch((e) => console.log(e)) It's error swallowing. The user isn’t watching the console. Solution: Show the...
Over-abstractor: A dev who immediately wants to abstract any new library...
Over-abstractor: A dev who immediately wants to abstract any new library we're considering. Examples: "Let's create a wrapper around React in case...
TypeScript radically improved my frontend code
TypeScript radically improved my frontend code. Here are 7 reasons I use TypeScript instead of JavaScript.
Just watched "React Query API Design: Lessons Learned" by @TkDodo 7 insights: 1
Just watched "React Query API Design: Lessons Learned" by @TkDodo 7 insights: 1. Don't be excited about major versions - they're *breaking*. 2. Des...
A codebase shouldn't feel like this, but I see it a lot
A codebase shouldn't feel like this, but I see it a lot. unused imports and packages rampant copy/paste half-written features unclear patterns comm...
Problem: Unused npm dependencies
Problem: Unused npm dependencies. They make package.json harder to read, bloat node_modules, waste our time updating packages we don’t use, and cre...
Today I'm auditing a codebase for a client
Today I'm auditing a codebase for a client. It has over 100 warnings. That's a problem. Why? Because if there are already warnings, I won't notice...
Problem: I want to see a list of the settings I've changed in VS Code
Problem: I want to see a list of the settings I've changed in VS Code. Solution: Search for "@modified". This displays a list of modified settings....
Just read "Next.js vs Tanstack" by @gill_kyle
Just read "Next.js vs Tanstack" by @gill_kyle. Summary: Next is comprehensive and offers many micro-optimizations. But caching is complex, it's har...
In TypeScript, there are at least 4 ways to implement immutability
In TypeScript, there are at least 4 ways to implement immutability. Here's how I choose between them.
Now that Node, Bun, and Deno can run TS files directly without compilation,...
Now that Node, Bun, and Deno can run TS files directly without compilation, using JSDoc syntax to declare TypeScript types is even harder to justif...
In TypeScript, interfaces and types are often interchangeable
In TypeScript, interfaces and types are often interchangeable. But these are 6 features that only work with a type alias. Clip from "TypeScript: Ge...
TypeScript is great
TypeScript is great. But it has 3 features that you should probably avoid. Here's what I suggest using instead. Clip from "TypeScript: Getting Star...
TypeScript will soon compile 10x faster
TypeScript will soon compile 10x faster. So, using JSDoc comments to declare types for "performance reasons" will soon be even harder to justify.