Keentune
TypeScript, oriented
11 chapters
·
about 15 min read
·
free
TypeScript is a checker that runs over JavaScript and then gets out of the way. Every type you write is erased before the code runs, so the language buys you one thing: mistakes reported at your desk instead of in production. Almost all the confusion beginners hit comes from expecting types to exist at runtime, or from expecting the checker to be stricter than it is by default. Read this for the shape of the system — what it checks, what it deliberately does not, and where it hands you the loaded gun.
Each chapter opens with the short version. Tap one to read the detail.
What TypeScript is, and what any costs
~2 min
Types are erased at compile time — none of them exist while your program runs. Prefer inference over annotations, and treat any as switching the checker off for that value, which is why unknown is usually the type you actually wanted.
Structural typing: shape decides, not names
~2 min
Compatibility is decided by structure, not by declared names — anything with the required members fits. Two rules bolted on top of that surprise people: object literals get an extra check, and a value with more properties is normally fine.
Describing object shapes
~2 min
Optional, readonly, and index signatures cover most object modelling. Both modifiers are shallower than they look: readonly stops reassignment but not mutation, and an optional property is not the same as one that may be undefined.
Functions, and why overloads are usually a mistake
~2 min
Parameters and return types are the boundary worth annotating. Overloads look like the tool for a function accepting several shapes, but a union parameter is almost always simpler and gives better errors.
Narrowing: how a union becomes one type
~2 min
The checker follows your control flow and narrows a union as you test it. Discriminated unions are the pattern that makes this reliable, and never turns an unhandled case into a compile error instead of a silent fall-through.
Generics and the keyof family
~2 min
A generic relates two types to each other; if a type parameter appears only once, you did not need one. Constraints with extends are what let you use a value you have not seen yet, and keyof ties a key argument to the object it indexes.
Types that compute types
~2 min
Conditional, mapped, and template literal types let one type be derived from another, and the built-in utilities are ordinary code written that way. The behaviour that catches everyone is distribution: a conditional type applied to a union runs once per member.
tsconfig: the flags that decide how much checking you get
~2 min
The same code is checked very differently depending on configuration, and strict is the switch that matters. Without strictNullChecks the compiler ignores null and undefined entirely, which removes the most valuable checking it does.
Modules and what ships to consumers
~2 min
A file with a top-level import or export is a module; without one it is a script sharing the global scope. import type is erased entirely, which is what keeps type-only dependencies out of your runtime bundle.
Classes, and the privacy that is not private
~2 min
Classes are the JavaScript feature with type annotations layered on. The one thing to know cold: private is checked by the compiler and gone at runtime, while #name is genuinely inaccessible.
Enums, and the modern alternative
~2 min
An enum is the rare TypeScript feature that emits real runtime code rather than being erased. A union of string literals does the same job with no runtime footprint, which is why most codebases now prefer it.
See the full TypeScript curriculum
Written by Keentune. We are not affiliated with or endorsed by the organizations whose documentation informs this guide, and any linked sources belong to their respective owners.
All exam, test, and product names and trademarks are the property of their respective owners and are used here for identification and reference only. Keentune is independent study practice — not affiliated with, authorized, or endorsed by any of these organizations.
© 2026 SportaApp LLC