Skip to content

Commit

Permalink
feat: using typeguard to narrow variable's type in Account's constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
jcaporossi-ledger committed Mar 24, 2022
1 parent ea6ae40 commit ed048f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/account/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export class Account extends Provider implements AccountInterface {

private signer: SignerInterface;

constructor(provider: Provider, address: string, keyPairOrSigner: KeyPair | Signer) {
constructor(provider: Provider, address: string, keyPairOrSigner: KeyPair | SignerInterface) {
super(provider);
this.signer =
keyPairOrSigner instanceof Signer ? keyPairOrSigner : new Signer(keyPairOrSigner as KeyPair);
'getPubKey' in keyPairOrSigner ? keyPairOrSigner : new Signer(keyPairOrSigner as KeyPair);
this.address = address;
}

Expand Down

0 comments on commit ed048f3

Please sign in to comment.