Record Types

Record Type
πŸ‘¨β€πŸ’Ό We need a lookup table by ID and a count for each role. A Record type gives us a clean way to describe those object shapes.
🐨 Open
index.ts
and:
  1. Create a UsersById type using Record that maps string IDs to User
  2. Create a RoleCounts type using Record that maps role strings to numbers
  3. Type the provided usersById and roleCounts objects with those aliases (remove the @ts-expect-error comments once the types exist)
  4. Export usersById and roleCounts by name

Completion criteria

  • Named exports: usersById, roleCounts
  • usersById.u1.name is 'Ava' and usersById.u2.role is 'member'
  • roleCounts deep-equals { admin: 1, member: 1 }

Please set the playground first

Loading "Record Types"
Loading "Record Types"