Skip to content

Commit 0e1721b

Browse files
committed
Fixed Contract properties that collide with null member properties (ethers-io#1393).
1 parent c47d2eb commit 0e1721b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/contracts/src.ts/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,9 +741,12 @@ export class Contract {
741741

742742
const signature = signatures[0];
743743

744-
if (this[name] == null) {
745-
defineReadOnly(this, name, this[signature]);
746-
}
744+
// If overwriting a member property that is null, swallow the error
745+
try {
746+
if (this[name] == null) {
747+
defineReadOnly(this, name, this[signature]);
748+
}
749+
} catch (e) { }
747750

748751
if (this.functions[name] == null) {
749752
defineReadOnly(this.functions, name, this.functions[signature]);

0 commit comments

Comments
 (0)