Thomas G. Lopes
include heading & install instrs
79784ac
raw
history blame
436 Bytes
// typed Object.keys
export function keys<T extends object>(o: T): (keyof T)[] {
return Object.keys(o) as (keyof T)[];
}
// typed Object.entries
export function entries<T extends object>(o: T): [keyof T, T[keyof T]][] {
return Object.entries(o) as [keyof T, T[keyof T]][];
}
// typed Object.fromEntries
export function fromEntries<T extends object>(entries: [keyof T, T[keyof T]][]): T {
return Object.fromEntries(entries) as T;
}