Skip to content

Commit

Permalink
feat(types): Add ObjectValues and ObjectEntries types
Browse files Browse the repository at this point in the history
  • Loading branch information
MorevM committed Oct 7, 2022
1 parent b4b8e59 commit 62171b3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export * from './numbers/math-subtract/math-subtract';
export * from './numbers/number-range/number-range';
export * from './objects/except/except';
export * from './objects/explicit/explicit';
export * from './objects/object-entries/object-entries';
export * from './objects/object-keys/object-keys';
export * from './objects/object-values/object-values';
export * from './objects/partial-optional/partial-optional';
export * from './objects/partial-required/partial-required';
export * from './objects/plain-object/plain-object';
Expand Down
7 changes: 7 additions & 0 deletions src/types/objects/object-entries/object-entries.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { PlainObject } from '../plain-object/plain-object';

/**
* Object entries. \
* Suitable for typing `Object.entries()`
*/
export type ObjectEntries<T extends PlainObject> = Array<[keyof T, T[keyof T]]>;
6 changes: 6 additions & 0 deletions src/types/objects/object-values/object-values.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { PlainObject } from '../plain-object/plain-object';

/**
* Object values as an union with optional ability to set which keys should be presented.
*/
export type ObjectValues<T extends PlainObject, K extends keyof T = keyof T> = T[K];

0 comments on commit 62171b3

Please sign in to comment.