Skip to content
Advertisement

How to type enum and object to have same properties React Typescript

i have an enum:

JavaScript

}

and i want to create an object(or enum also) with the same properties (only goToInit and lockIp)

JavaScript

}

Advertisement

Answer

You can use a Record and just use the enum as the first generic parameter for the key and then whatever function type you want to have next.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement