1
0
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:
Florian Bouillon 2022-12-08 13:58:41 +01:00
parent 49f16223c3
commit ddb0a4820a
Signed by: Florian Bouillon
GPG Key ID: E05B3A94178D3A7C
2 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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>
}
/**