Put in order · JavaScript and TypeScript course · Module 7: Advanced TypeScript

Steps to Create a Generic Utility Type

Order the steps for creating a generic utility type:

Items to put in order

  • Iterate over keys using keyof
  • Apply the transformation (readonly, optional)
  • Define the generic parameter T
  • Return the new mapped type
  • Add constraints (extends)

You can check the correct answer by solving this task in the CodeWorlds game.