~/devtype

TypeScript Typing Speed Test

TypeScript adds a whole second grammar on top of JavaScript: angle-bracket generics, colon annotations, and pipe-separated unions. If your fingers hesitate on `<T extends keyof U>`, these drills are for you.

LV 1
Level 0 / 100 XP
Best 0 WPM
main.js
00 wpm
00%
0s
1
Just start typing or click the code
Esc restart Enter new line, indentation is skipped for you

Typing Type Annotations at Speed

TypeScript's signature friction point is the angle bracket. Generics like `Record<string, User[]>` demand Shift-comma and Shift-period reaches while your mind is mid-thought about the type itself. Union types chain the pipe character (`|`), and intersection types the ampersand (`&`) — both awkward right-hand stretches that benefit enormously from deliberate practice.

Annotation rhythm matters too: the pattern `name: Type` appears dozens of times per file, so the colon-space-capital sequence should be a single fluid motion. Utility types (`Partial<T>`, `Omit<T, K>`) and mapped types add bracket-heavy structures that reward practicing bracket pairs as unified chunks rather than individual keys.

Key Drills for TypeScript:

  • Chunk the generic: Type `<T>` as one gesture. Angle brackets are the highest-frequency shifted pair in TypeScript.
  • Colon-space rhythm: The `: Type` pattern is everywhere. Make colon-then-capital a reflex, not two decisions.
  • Pipe without looking: Union types make `|` a daily key. Anchor your right pinky so the reach doesn't break your flow.

Sample Drill: Generic Interface & Type

Declaring generic interfaces and strict types in TypeScript.

ts-interface · easy
interface ApiResponse<T> {
  data: T;
  status: number;
  message: string;
}

type UserID = string | number;

All 15 TypeScript Drills

Every session picks a random drill from this pool. Use the difficulty filter above to stay on easy warm-ups or jump straight to the hard ones.

  • Generic Interface & Type easy

    Declaring generic interfaces and strict types in TypeScript.

  • String Literal Union easy

    Restrict a variable to a fixed set of string states.

  • Const Array to Union easy

    Derive a union type from a readonly array declared with as const.

  • Typed Default Parameters easy

    Format a currency amount with a typed default parameter.

  • Record Lookup Table easy

    Use Record to require an entry for every key in a union.

  • Custom Type Guard medium

    Narrowing types with user-defined type guard functions.

  • Discriminated Union Switch medium

    Narrow a tagged union with a switch on its kind field.

  • Generic Pluck with keyof medium

    A generic helper constrained by keyof that returns typed values.

  • Zod Schema & Inference medium

    Validate a request body with Zod and infer its static type.

  • Satisfies Operator medium

    Check a config object against a type while keeping literal keys.

  • Mapped & Utility Types hard

    Building readonly partial types with mapped type modifiers.

  • Result Type Wrapper hard

    Wrap a promise so callers get a typed success or error value.

  • Conditional Types & infer hard

    Recursive mapped and conditional types that unwrap nested shapes.

  • Typed Event Emitter hard

    A generic emitter whose payload type depends on the event name.

  • Template Literal Types hard

    Build route keys and getter names with template literal types.

The Symbols That Slow You Down

The keystrokes below are where TypeScript typing speed is won or lost. Key positions shown for QWERTY — the pattern transfers to any layout, just on different physical keys.

Symbol Used For Keys How to Drill It
<> Generic brackets < as Shift+Comma, > as Shift+Period Shifted comma and period with a type name between. The single most characteristic TS keystroke pair.
| Union pipe Shift+Backslash One of the farthest reaches on the board. Union types make it frequent — anchor the ring-finger stretch.
: Type annotation Shift+Semicolon Every `name: Type` pair starts here. Colon-space-capital should be one continuous motion.
& Intersection Shift+7 Less common than the union pipe but just as awkward. Practice `A & B` without pausing at the ampersand.
>> Nested generic closer Shift+Period twice Deep generics close in bursts: `>>` or even `>>>`. Two Shift-period strikes without releasing rhythm.
?: Optional property ? as Shift+Slash, then : as Shift+Semicolon Two shifted punctuation marks back to back in interface definitions. Type them as one chunk.

Common TypeScript Typing Mistakes

  • ✗ Skipping the space after a colon in annotations — `name:Type` parses fine but the missing rhythm compounds across a file.
  • ✗ Confusing the union pipe with its unshifted backslash neighbor sitting directly beneath it.
  • ✗ Dropping the closing bracket of a generic when the type name runs long — practice `Array<Map<string, number>>` end to end.

What's a Good TypeScript Typing Speed?

TypeScript runs slightly slower than plain JavaScript because of annotation overhead: 25–35 WPM is solid during real typing, and 40+ WPM with 95%+ accuracy is excellent. Generics-heavy files are where you'll feel the difference most.