Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript object key enum

// Since 2018, there is an easier way in Typescript, 
//without using keyof typeof:

let layer: { [key in MyEnum]: any}

// To not have to include all keys:

let layer: { [key in MyEnum]?: an
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #typescript #object #key #enum
ADD COMMENT
Topic
Name
2+1 =