Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

Typescript loop over enum

function enumKeys<O extends object, K extends keyof O = keyof O>(obj: O): K[] {
    return Object.keys(obj).filter(k => Number.isNaN(+k)) as K[];
}
Source by www.petermorlion.com #
 
PREVIOUS NEXT
Tagged: #Typescript #loop #enum
ADD COMMENT
Topic
Name
8+9 =