Skip to content

Commit

Permalink
Fixed Contract properties that collide with null member properties (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Mar 26, 2021
1 parent c47d2eb commit 0e1721b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/contracts/src.ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -741,9 +741,12 @@ export class Contract {

const signature = signatures[0];

if (this[name] == null) {
defineReadOnly(this, name, this[signature]);
}
// If overwriting a member property that is null, swallow the error
try {
if (this[name] == null) {
defineReadOnly(this, name, this[signature]);
}
} catch (e) { }

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

0 comments on commit 0e1721b

Please sign in to comment.