#17. Добавление затипизированных objectKeys и objectEntries (#26)

This commit is contained in:
Nikolay
2020-12-28 00:27:18 +03:00
committed by GitHub
parent fbe6f9d286
commit 94525edd98
2 changed files with 6 additions and 0 deletions

View File

@ -0,0 +1,3 @@
export const objectEntries = <T extends Record<string, unknown>, R extends keyof T>(obj: T) => (
Object.entries(obj) as Array<[R, T[R]]>
);

View File

@ -0,0 +1,3 @@
export const objectKeys = <T extends Record<string, unknown>>(obj: T) => (
Object.keys(obj) as Array<keyof T>
);