diff options
| author | ST-DDT <[email protected]> | 2023-12-11 19:42:59 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-12-11 18:42:59 +0000 |
| commit | 1631115a6a9846c50473fe60ea5bdb7ce9d04084 (patch) | |
| tree | 6b9dcb203e31aea8ff2233ef60046278139ea71b /src | |
| parent | 60dcfe7c6454327740d2253ed283deb59d420462 (diff) | |
| download | faker-1631115a6a9846c50473fe60ea5bdb7ce9d04084.tar.xz faker-1631115a6a9846c50473fe60ea5bdb7ce9d04084.zip | |
infra(tsconfig): noImplicitAny (#2562)
Diffstat (limited to 'src')
| -rw-r--r-- | src/internal/keys.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/internal/keys.ts b/src/internal/keys.ts new file mode 100644 index 00000000..d67d32e7 --- /dev/null +++ b/src/internal/keys.ts @@ -0,0 +1,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>; +} |
