Browse Source

ts: Fix undefined iterable (#571)

Armani Ferrante 4 years ago
parent
commit
21cc98517a
1 changed files with 2 additions and 2 deletions
  1. 2 2
      ts/src/coder/instruction.ts

+ 2 - 2
ts/src/coder/instruction.ts

@@ -90,7 +90,7 @@ export class InstructionCoder {
         let fieldLayouts = m.args.map((arg: IdlField) => {
           return IdlCoder.fieldLayout(
             arg,
-            Array.from([...idl.accounts, ...idl.types])
+            Array.from([...idl.accounts, ...(idl.types ?? [])])
           );
         });
         const name = camelCase(m.name);
@@ -101,7 +101,7 @@ export class InstructionCoder {
           let fieldLayouts = ix.args.map((arg: IdlField) =>
             IdlCoder.fieldLayout(
               arg,
-              Array.from([...idl.accounts, ...idl.types])
+              Array.from([...idl.accounts, ...(idl.types ?? [])])
             )
           );
           const name = camelCase(ix.name);