Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript key values interface key from enum

export type colorsInterface = {
    [key in colorsEnum]?: boolean;
};

let example: colorsInterface = {
    [colorsEnum.red]: true,
    [colorsEnum.blue]: false
};
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #typescript #key #values #interface #key #enum
ADD COMMENT
Topic
Name
2+1 =