function strEnum(o: Array): {[K in T]: K} { return o.reduce((res, key) => { res[key] = key; return res; }, Object.create(null)); } export const DocumentTypes = strEnum([]); export type DocumentTypes = keyof typeof DocumentTypes;