fix: Appease flow

This commit is contained in:
Tyera Eulberg 2019-05-23 17:18:13 -06:00 committed by Michael Vines
parent 41d14bec22
commit 78ad376bcd
1 changed files with 7 additions and 3 deletions

View File

@ -77,7 +77,7 @@ type SignaturePubkeyPair = {|
*
*/
type TransactionCtorFields = {|
recentBlockhash?: Blockhash,
recentBlockhash?: Blockhash | null,
signatures?: Array<SignaturePubkeyPair>,
|};
@ -109,7 +109,7 @@ export class Transaction {
/**
* A recent transaction id. Must be populated by the caller
*/
recentBlockhash: ?Blockhash;
recentBlockhash: Blockhash | null;
/**
* Construct an empty Transaction
@ -122,7 +122,9 @@ export class Transaction {
* Add one or more instructions to this Transaction
*/
add(
...items: Array<Transaction | TransactionInstructionCtorFields>
...items: Array<
Transaction | TransactionInstruction | TransactionInstructionCtorFields,
>
): Transaction {
if (items.length === 0) {
throw new Error('No instructions');
@ -131,6 +133,8 @@ export class Transaction {
items.forEach(item => {
if (item instanceof Transaction) {
this.instructions = this.instructions.concat(item.instructions);
} else if (item instanceof TransactionInstruction) {
this.instructions.push(item);
} else {
this.instructions.push(new TransactionInstruction(item));
}