aboutsummaryrefslogtreecommitdiff
path: root/src/internal/keys.ts
blob: d67d32e7d82d64b0455832f57b7d89fe6a561585 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/**
 * Specialized version of `Object.keys()` which preserves the type information of the keys.
 *
 * Please note that the type information might be inaccurate for subtypes of the argument type
 * and thus should only be used to cover the property access of the object.
 *
 * @internal
 *
 * @param obj The object to get the keys of.
 */
export function keys<T extends object>(obj: T): Array<keyof T> {
  return Object.keys(obj) as Array<keyof T>;
}