import { DeepReadonly , TaggedObject } from '../types/objects' ; param obj param k export function isKeyOf < T extends object > ( obj , k ) { return k in obj ; } param obj returns export function objectKeys < T extends object > ( obj ) { return Object . keys ( obj ) as Array < keyof T > ; } param obj returns export function Readonly < T extends object > ( obj ) { return obj as any ; } param obj param key returns export function taggedObject < T extends Record < keyof any , object > , K extends string > ( obj , key ) { const keys = objectKeys ( obj ) ; return keys . reduce ( ( collection , k ) => { const inner = obj [ k ] ; collection [ k ] = { [ key ] : k , ... inner , } ; return collection ; } , { } as TaggedObject < T , K > ) ; }