Skip to main content

The Typer

A Learning TypeScript > Objects 🍲 entree project.

Hmmph.

Last of your kind. A wandering soul -- not lost, but never found. Your keen instincts for type safety and sound type systems are a dim light in the dark and dismal world around you. You are The Typer.

An old friend of yours recently gave you a map purporting to include a rare and desirable treasure. The map is missing TypeScript type annotations, but otherwise seems acceptable.

Can you fill out type annotations to make the map more usable?

Setup

If you haven't yet, set up the github.com/LearningTypeScript/projects repository locally.

git clone https://github.com/LearningTypeScript/projects learning-typescript-projects
cd learning-typescript-projects
npm i

Change your terminal directory to this project's:

cd projects/objects/the-typer

In a terminal, start the TypeScript compiler in watch mode:

tsc --watch

Specification

In ./index.ts, add TypeScript type annotations to get TypeScript to compile without type errors.

Notes

  • Don't use any or leave any implicit anys.
  • Don't use any arrays or functions, as they haven't been covered in Learning TypeScript yet.
  • Don't change any runtime code -- it's fine as-is.