From 21a28e003a998dc78b2e73ee32bc1ad72a68f76b Mon Sep 17 00:00:00 2001 From: Valentin Fernandez <33705477+valentinfernandez1@users.noreply.github.com> Date: Wed, 12 Feb 2025 10:09:40 -0300 Subject: [PATCH] Only identify Struct as empty when it has no keys. (#6092) * Fix isEmpty on Struct * Improve code --- packages/types-codec/src/native/Struct.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/types-codec/src/native/Struct.ts b/packages/types-codec/src/native/Struct.ts index dee41a4abc..b0c16e6b9f 100644 --- a/packages/types-codec/src/native/Struct.ts +++ b/packages/types-codec/src/native/Struct.ts @@ -154,16 +154,10 @@ export class Struct< } /** - * @description Checks if the value is an empty value + * @description Checks if the value is an empty value '{}' */ public get isEmpty (): boolean { - for (const v of this.values()) { - if (!v.isEmpty) { - return false; - } - } - - return true; + return [...this.keys()].length === 0; } /**