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.
shell
git clone https://github.com/LearningTypeScript/projects learning-typescript-projectscd learning-typescript-projectsnpm i
shell
git clone https://github.com/LearningTypeScript/projects learning-typescript-projectscd learning-typescript-projectsnpm i
Open your editor in this project's directory:
shell
code projects/objects/the-typer
shell
code projects/objects/the-typer
In your terminal, run the TypeScript compiler via the tsc
script.
For example, to start the TypeScript compiler in watch mode:
shell
npm run tsc -- --watch
shell
npm run tsc -- --watch
Specification
In ./index.ts
, add TypeScript type annotations to get TypeScript to compile without type errors.
Notes
Note: your terminal should be in the
the-typer
directory, not the root repository's directory.
- Don't use
any
or leave any implicitany
s. - 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.