Skip to content

Commit 21a28e0

Browse files
Only identify Struct as empty when it has no keys. (#6092)
* Fix isEmpty on Struct * Improve code
1 parent 7bd4c7a commit 21a28e0

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

packages/types-codec/src/native/Struct.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,10 @@ export class Struct<
154154
}
155155

156156
/**
157-
* @description Checks if the value is an empty value
157+
* @description Checks if the value is an empty value '{}'
158158
*/
159159
public get isEmpty (): boolean {
160-
for (const v of this.values()) {
161-
if (!v.isEmpty) {
162-
return false;
163-
}
164-
}
165-
166-
return true;
160+
return [...this.keys()].length === 0;
167161
}
168162

169163
/**

0 commit comments

Comments
 (0)