mirror of
https://github.com/dzeiocom/libs.git
synced 2025-06-06 08:19:53 +00:00
fix(object-util): Typescript outputing error when using object with undefined
Signed-off-by: Avior <f.bouillon@aptatio.com>
This commit is contained in:
parent
49f16223c3
commit
ddb0a4820a
@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.4.5] - 2022-12-08
|
||||
|
||||
### Fixed
|
||||
|
||||
- Typescript returning errors when object can contains undefined
|
||||
|
||||
## [1.4.4] - 2022-12-08
|
||||
|
||||
### Fixed
|
||||
|
@ -1,5 +1,5 @@
|
||||
type BasicObjectKeys = string | number | symbol
|
||||
type BasicObject<K extends BasicObjectKeys = BasicObjectKeys, V = any> = Record<K, V>
|
||||
type BasicObject<K extends BasicObjectKeys = BasicObjectKeys, V = any> = { [P in K]?: V }
|
||||
|
||||
/**
|
||||
* Remap an object to an array through a function
|
||||
@ -50,7 +50,7 @@ export function objectLoop<T = any, K extends BasicObjectKeys = BasicObjectKeys>
|
||||
*/
|
||||
export function objectValues<T = any>(obj: BasicObject<BasicObjectKeys, T>): Array<T> {
|
||||
mustBeObject(obj)
|
||||
return Object.values(obj)
|
||||
return Object.values(obj) as Array<T>
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user