Describe an Object with a Type

Write the code, see it run, pass the checks.

The problem

  • easy
  • Code

Export a type Book with a title (a string) and pages (a number). Then write describeBook(book), which returns the title followed by the page count, like "Dune (412 pages)". A book missing either field should be a type error.

Your code must pass

  • Describes a book
  • Has no type errors
  • Book has a title and pages
  • Rejects a book without pages