Skip to Content
Skip to content
Tutorials

Programming Tutorials

Standalone programming tutorials for solving one specific problem at a time. Each guide starts with the exact error message, failing behavior, or design constraint, gives you a minimal reproducible script or query, and walks through the fix with real output.

Pick a language below or filter by topic and difficulty when you need a quick, practical reference you can test locally and apply right away.

TypeScript
Brand a userId So It Won't Accept an orderId Level: Advanced

Add a brand to two string ids and a parse function that creates them. After this, passing an orderId where a userId is expected is an error in the editor.

TypeScript
Conditional Types That Extract a Promise's Value Level: Advanced

Write a conditional type with infer that takes the value out of a promise and see how it differs from Awaited.

TypeScript
const Assertions for a Fixed Lookup Table Level: Advanced

Freeze a lookup table with as const and derive its keys and values as types. After this, the table and the type that describes it can never drift apart.

TypeScript
Migrate One Module While Testing Its JavaScript Boundary Level: Advanced

Convert one JavaScript module, catch a lost runtime guard, and verify an unchanged JavaScript caller against the emitted TypeScript build.

TypeScript
Diagnose a Stale TypeScript Project-Reference Build Level: Advanced

Reproduce a project-only build that consumes stale shared declarations, rebuild the graph, and verify that an API change reaches its consumer.

TypeScript
satisfies on a Config Object Without Widening Level: Advanced

Check a config object against a type with satisfies and keep its precise keys and literal values. After this, a typo in a key is caught and the object still autocompletes.

TypeScript
Speed Up tsc With incremental and Smarter Includes Level: Advanced

Count the files tsc reads, narrow the include list and turn on incremental with a cache file. After this, you know which change made the build faster because you measured it.

TypeScript
Template Literal Types for /users/:id Routes Level: Advanced

Turn a route pattern into a type that finds the parameter names and checks the paths you pass. After this, a typo in a route or a missing parameter is a compile error.

TypeScript
Hand-Write a .d.ts for a Small JS Helper Level: Advanced

Write a declaration file for a JavaScript helper with a generic function and an overload, then test it with a short file.

SQL
Connect With psql and List Your Tables Level: Beginner

Connect to a database with psql and use the backslash commands to list tables and columns. After this, you can see what is inside any database you can reach.

SQL
Count Rows Per Group With GROUP BY Level: Beginner

Count rows per category with GROUP BY, sort the biggest group first and keep only large groups with HAVING. After this, one query answers a how-many-for-each question.

SQL
Find Duplicate Rows Level: Beginner

Find repeated values with GROUP BY and HAVING, list the full rows and catch duplicates that differ by capital letters.