Command Palette

Search for a command to run...

Hectal
Phase 17: Interviews and Capstone
TypeScript · Exercise 3 of 6 PreviousNext
Advanced

Challenge: Includes and MyAwaited

Write Includes<T, U>: true if the tuple T has an element that is exactly U, else false. Includes<[boolean], true> must be false (the element is boolean, not true).

Write MyAwaited<T>: unwrap nested promises, so MyAwaited<Promise<Promise<string>>> is string, and a non-promise like number stays number.

What Check tests

  1. Your code has no type errors
  2. Includes is false for an empty tuple
  3. Includes finds the last element
  4. MyAwaited leaves a plain value alone
  5. A wrong expectation is rejected

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Console

Nothing printed yet.