What does the following produce? type EventName = ‘click’ | ‘focus’; type Handler = `on${Capitalize}`;

TypeScript Associate Hard

TypeScript Associate — Hard

What does the following produce? type EventName = ‘click’ | ‘focus’; type Handler = `on${Capitalize}`;

Key points

  • Template literals can be used to dynamically generate values
  • The `${}` syntax allows for string interpolation
  • Capitalize function capitalizes the first letter of a string
  • Incorrect options did not apply the Capitalize function correctly

Ready to go further?

Related questions