█
LastWrite
  • > Curriculum
  • > Pricing
  • > For Educators
  • > About
  • > Contact
Log InGet Started

Questions, concerns, bug reports, or suggestions? We read every message, write to us at [email protected].

More ways to reach us →
LastWrite

Structured computer science lessons for aspiring developers and security professionals.

[email protected]

(201) 785-7951

Mon–Fri, 9 AM–5 PM EST

Learn

  • Curriculum
  • Pricing

Company

  • About
  • For Educators & Schools
  • Contact Us

Legal

  • Terms of Service
  • Privacy Policy
© 2026 LastWrite. All rights reserved.
Curriculum/Programming Languages/TypeScript/Passion Project: Type-First TS Library
180 minAdvanced

Passion Project: Type-First TS Library

After this lesson, you will be able to: Design and publish a fully type-inferred TypeScript library where the type system does the work: generics, conditional and mapped types, and a public API that needs zero manual annotations from consumers.

Passion project per Curriculum-Upgrade.md. The TS differentiator is type-level design. Build something where a consumer gets perfect autocomplete and red squiggles without writing a single type themselves.

Prerequisites:Migrating JavaScript to TypeScript

Project: a type-first library (pick one)

Options: a typed event emitter (event names + payloads inferred), a typed config/schema validator, a typed query/filter builder, or a typed state machine. The types are the product.

  1. 1

    M1: scaffold TS strict + tsup for dual ESM/CJS + `.d.ts` emit. Turn on `exactOptionalPropertyTypes` and `noUncheckedIndexedAccess`.

  2. 2

    M2: design the public type signatures FIRST. Write the consumer call site you wish existed, then make the types satisfy it.

  3. 3

    M3: implement with generics + conditional/mapped types so return types narrow from inputs (no `as` casts in the public API).

  4. 4

    M4: write type-level tests with `expectTypeOf` (Vitest) or `tsd` asserting inference works and bad calls fail to compile.

  5. 5

    M5: runtime tests with Vitest for the actual behaviour.

  6. 6

    M6: README with a usage example that visibly shows inference (a screenshot of autocomplete helps). JSDoc every export.

  7. 7

    M7: `npm publish` with a correct `types` export. Tag v0.1.0. Solve 5 Type Challenges and link the solutions in the README.

💡 What gets you the interview

Open your library in the interviewer's editor (or a screenshot) and show autocomplete narrowing as you type. Inference that 'just works' is the clearest proof of advanced TS. Then explain one conditional type you wrote and why.

Common mistakes

Leaking `any` or `as` casts into the public API. Consumers feel it immediately. No type-level tests, so a refactor silently breaks inference. Over-engineering the types into something unreadable. Senior TS is also about restraint. Shipping without `exactOptionalPropertyTypes` / strict, then claiming 'strict TS' on the resume.

Sign in and purchase access to unlock this lesson.

Sign in to purchase
←Migrating JavaScript to TypeScript
Back to TypeScript
TypeScript Job Readiness→