Skip to Content
0 likes
Python Type Hints: Catch Bugs Before Your Users Do Level: Advanced

Python ignores type hints when it runs. A checker like mypy doesn't. See one file crash on its first bug, then see mypy find both bugs before anything runs, and learn where to start adding hints in an existing project.

0 likes
Adding mypy to an Existing Python Project Without 500 Errors on Day One Level: Advanced

Start mypy with its defaults, fix what it finds, turn on check_untyped_defs, then make one module at a time strict. Every function you annotate checks every place that calls it, so start with the busiest ones.

0 likes
Type-Check Plain JavaScript With JSDoc and @ts-check Level: Advanced

Add // @ts-check to the top of a file and JSDoc types to your functions, and the TypeScript checker flags wrong arguments in your editor and in CI. No build step, no .ts files.

0 likes
Fix "Cannot find name" After Renaming a .js File Level: Beginner

Install the Node types, turn them on in tsconfig.json, and switch require to import. Also covers the other causes of the same error: a typo, a missing import and a missing lib.

0 likes
Find Which TypeScript Compiler Your Project Runs Level: Beginner

Trace a compiler version mismatch, confirm the resolved package path, and make a project-local check catch a deliberate type error.

0 likes
Narrow a Union With typeof and in Level: Beginner

Use typeof, in and Array.isArray on three real unions, and avoid the two mistakes that stop narrowing from working. After this, you know which check fits which union.

0 likes
Optional Properties vs undefined: Which One You Meant Level: Beginner

See the difference between a question mark and a union with undefined, what it does at run time, and what exactOptionalPropertyTypes changes. After this, you can choose the right one for your data.

0 likes
Read a TypeScript Error Message Without Guessing Level: Beginner

Read an error in three passes and match the eight most common phrases to their causes, using real tsc output. After this, a wall of errors is a list you can work through.

0 likes
Function Return Types That Catch Missing returns Level: Beginner

Let a declared return type find a branch with no return, an arrow function with braces, and an async function typed wrong. After this, a function cannot quietly give back undefined.

0 likes
Stop Using any: Replace It in 10 Minutes Level: Beginner

Find every any, then replace each one with a named type, a function type or unknown with a check. After this, a typo like prise is a compile error instead of NaN.

0 likes
tsconfig strict: Turn It On Without 200 Errors Level: Beginner

Count what each strict flag costs, turn them on one at a time, park one stubborn error with ts-expect-error, and finish with strict true. After this, an old project can move to strict in steps.

0 likes
Type an Object Without Copy-Pasting the Shape Twice Level: Beginner

Write an object shape once with type, derive one from an existing object with typeof, and share it between files with import type. After this, a renamed property shows you every place to fix.