From 1a0677800eedb7c65f32cbb00718f8d8f1f72c63 Mon Sep 17 00:00:00 2001 From: Dominique Date: Mon, 18 Mar 2024 17:10:22 +0100 Subject: [PATCH] fix: add optional chaining operator in `toHuman` (#5825) * fix: add optional chaining operator in toHuman * fix typo --- packages/types-codec/src/native/Json.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/types-codec/src/native/Json.ts b/packages/types-codec/src/native/Json.ts index 699f2a2152..93a72b7fbb 100644 --- a/packages/types-codec/src/native/Json.ts +++ b/packages/types-codec/src/native/Json.ts @@ -88,11 +88,11 @@ export class Json extends Map implements Codec { } /** - * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information + * @description Converts the Object to a human-friendly JSON, with additional fields, expansion and formatting of information */ public toHuman (): Record { return [...this.entries()].reduce>((json, [key, value]): Record => { - json[key] = isFunction((value as Codec).toHuman) + json[key] = isFunction((value as Codec)?.toHuman) ? (value as Codec).toHuman() : value as AnyJson;