0 of 6 problems solved0%
1 of 6

User Label (id & name)

Object shapes let you describe which properties an object must have. Here you’ll work with a small User-like shape { id: number; name: string } and return a formatted label. This reinforces structural typing and reading typed properties.

Your Task

  • Complete the function userLabel(user: { id: number; name: string }): string.
  • Return the string 'id:' + user.id + ' name:' + user.name.
  • Do not mutate user.

Examples

  • userLabel({ id: 1, name: 'A' }) → 'id:1 name:A'
  • userLabel({ id: 42, name: 'Taylor' }) → 'id:42 name:Taylor'