Module 2 · In Studio · challenge 3 of 3 in this lesson

challenges/luau_types_work.luau implements parseItem(value: unknown): ShopItem? by comparing, not casting

A test in Studio grades it and prints a pass code.

Open

Level 3, Professional

Challenge

Start from the m14-ship tag in the game repo and write a type-safe parser for shop items and a generic helper. You edit only challenges/luau_types_work.luau; the solution is challenges/solutions/luau-types.md in the game repo.

Start from
The game at milestone m14 (download)
Grade it
In Studio, press Play, then run game.ServerScriptService.RunGameTests:Invoke("luau-types") in the server command bar. Copy the pass code from Output.

Done means

  • challenges/luau_types_work.luau implements parseItem(value: unknown): ShopItem? by comparing, not casting
  • firstWhere<T> returns the first item the predicate accepts, or nil
  • The Course Runner prints TEST PASS for all eleven checks and a pass code
  • luau-lsp analyze reports no errors for the file

The Course Runner prints this code when the test passes.