File size: 436 Bytes
b924465
 
 
 
79784ac
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// 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;
}