Squashed 'third_party/flatbuffers/' changes from bc44fad35..8aa8b9139

8aa8b9139 Fix handling of +/-inf defaults in TS/rust/go/dart codegen (#7588)
001adf782 Add support for parsing proto map fields (#7613)
dbc58ab77 Fix help output for --gen-includes (#7611)
2facfeec7 Fix missing spaces in flatc help text (#7612)
4de2814c7 Fix: arduino platform build (#7625)
37b1acdaf Fix current official name of macOS (#7627)
a22434e2a Add missing #include <algorithm> for std::min/std::max uses, and #include <limits> for std::numeric_limits<> (#7624)
214cc9468 Bump Rust version to 22.10.26 before publication (#7622)
a4ff275d9 Added option to not requires an EoF token when parsing JSON (#7620)
15f32c690 python: object generation prefix and suffix (#7565)
051afd882 Add CreateSharedString to python builder (#7608)
728c033ad Add check for presence of realpath to CMakeLists.txt to support more platforms (#7603)
4c514483d Update DartTest.sh golden files (#7606)
c2d9c2080 [TS] Add support for fixed length arrays on Typescript (#5864) (#7021) (#7581)
e34ae4c6b `build.yml`: Fix missing 'v' in version
e54536127 `build.yml` Update to Kotlin Wrapper 1.0.5
49d9f941c `release.yml` Use env var for passphrase
cefc21c1f `release.yml` Add GPG key for Maven
3e64fa724 `release.yml`: Add Maven Steps
b15f3c57e `release_yml` Use new dotnet version
ff802c680 `release.yml` Use NuGet Key directly
b401957d5 `release.yml` Changed Push to follow examples
8c8151f8f `release.yml` Fix nuget push command
ebb7c203d `release.yml` Add Nuget support
203241ed3 FlatBuffers Version 22.10.26 (#7607)
ac485609c `setup.py`: Define version directly
de5b85aa6 `release.yml`: Switch to `python` directory
de3df2d88 `release.yml`: Add publishing to PyPi
043a24f2e [Python] Fixed the issue with nested unions relying on InitFromBuf. (#7576)
5a48b0d7d release.yml: Typo
ce307556f release.yml: Remove `npm ci`
cb616e27c Create release.yml (#7605)
a54ca1e75 FlatBuffers Version 22.10.25 (#7604)
5b3fadcc1 [vector] Allow to iterate with mutables (#7586)
872a49746 [Nim] Bfbs Nim Generator (#7534)
e30170296 Make type conversions explicit. (#7595)
f7b734438 Fix LongEnum definitions (#7596)
5792623df Rust fix compilation for no_std targets #2 (#7553)
0edb27528 Update Rust version (#7574)
acc6a20d3 tests/test.cpp contains a couple of tests that are only executed (#7571)
04cd037ba Fix #7580 by documenting union schema evolution rules (#7585)
e1c5db988 Turn on clippy for Rust and fix lints for non-generated code (#7575)
b80142b90 Update documentation to mention enum value attributes (#7570)
54418f371 Add support for metadata attributes for enum values (#7567) (#7568)
c92e78a9f FlatBuffers Version 22.9.29 (#7557)
d243b904c [TS] Make strict compliant and improve typings (#7549)
374f8fb5f Rust soundness fixes (#7518)
dadbff571 Moves swift package to root of repository so it can be used directly … (#7548)
76ddae006 FlatBuffers Version 22.9.24 (#7547)
cfe157ec5 Emit internal enums when swift_implementation_only (#7545)
413115858 [Python] Python fixed size array (#7529)
88046190e Upgrade grpc to 1.49.0 and make sure it builds (#7538)
72aa85a75 [C++] Rare bad buffer content alignment if sizeof(T) != alignof(T) (#7520)
bfceebb7f Fix conform (#7532)

git-subtree-dir: third_party/flatbuffers
git-subtree-split: 8aa8b9139eb330f27816a5b8b5bbef402fbe3632
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
Change-Id: I943faba499baf58e9f561b1e4734922188ba8626
diff --git a/tests/ts/JavaScriptComplexArraysTest.js b/tests/ts/JavaScriptComplexArraysTest.js
new file mode 100644
index 0000000..f8601ed
--- /dev/null
+++ b/tests/ts/JavaScriptComplexArraysTest.js
@@ -0,0 +1,129 @@
+/* global BigInt */
+
+import assert from 'assert';
+import { readFileSync, writeFileSync } from 'fs';
+import * as flatbuffers from 'flatbuffers';
+import {
+  ArrayStructT,
+  ArrayTable,
+  ArrayTableT,
+  InnerStructT,
+  NestedStructT,
+  OuterStructT,
+  TestEnum,
+} from './arrays_test_complex/arrays_test_complex_generated.js';
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+BigInt.prototype.toJSON = function () {
+  return this.toString();
+};
+function fbObjToObj(fbObj) {
+  const ret = {};
+  for (const propName of Object.keys(fbObj)) {
+    const key = propName;
+    const prop = fbObj[key];
+    if (prop.valueOf) {
+      ret[key] = prop.valueOf();
+    } else if (typeof prop === 'object') {
+      ret[key] = fbObjToObj(prop);
+    }
+  }
+  return ret;
+}
+function testBuild(monFile, jsFile) {
+  const arrayTable = new ArrayTableT(
+    'Complex Array Test',
+    new ArrayStructT(
+      221.139008,
+      [-700, -600, -500, -400, -300, -200, -100, 0, 100, 200, 300, 400, 500, 600, 700],
+      13,
+      [
+        new NestedStructT(
+          [233, -123],
+          TestEnum.B,
+          [TestEnum.A, TestEnum.C],
+          [
+            new OuterStructT(
+              false,
+              123.456,
+              new InnerStructT(
+                123456792.0,
+                [13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
+                91,
+                BigInt('9007199254740999')
+              ),
+              [
+                new InnerStructT(
+                  -987654321.9876,
+                  [255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243],
+                  123,
+                  BigInt('9007199254741000')
+                ),
+                new InnerStructT(
+                  123000987.9876,
+                  [101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113],
+                  -123,
+                  BigInt('9007199254741000')
+                ),
+              ],
+              new InnerStructT(
+                987654321.9876,
+                [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
+                19,
+                BigInt('9007199254741000')
+              ),
+              [111000111.222, 222000222.111, 333000333.333, 444000444.444]
+            ),
+          ]
+        ),
+      ],
+      -123456789
+    )
+  );
+  const builder = new flatbuffers.Builder();
+  builder.finish(arrayTable.pack(builder));
+  if (jsFile) {
+    const obj = fbObjToObj(arrayTable);
+    writeFileSync(jsFile, `export default ${JSON.stringify(obj, null, 2)}`);
+  }
+  if (monFile) {
+    writeFileSync(monFile, builder.asUint8Array());
+  }
+  return builder.asUint8Array();
+}
+function testParse(monFile, jsFile, buffer) {
+  if (!buffer) {
+    if (!monFile) {
+      console.log(`Please specify mon file read the buffer from.`);
+      process.exit(1);
+    }
+    buffer = readFileSync(monFile);
+  }
+  const byteBuffer = new flatbuffers.ByteBuffer(new Uint8Array(buffer));
+  const arrayTable = ArrayTable.getRootAsArrayTable(byteBuffer).unpack();
+  const json = JSON.stringify(arrayTable, null, 2);
+  if (jsFile) {
+    writeFileSync(jsFile, `export default ${json}`);
+  }
+  return arrayTable;
+}
+if (process.argv[2] === 'build') {
+  testBuild(process.argv[3], process.argv[4]);
+} else if (process.argv[2] === 'parse') {
+  testParse(process.argv[3], process.argv[4], null);
+} else {
+  const arr = testBuild(null, null);
+  const parsed = testParse(null, null, Buffer.from(arr));
+  assert.strictEqual(parsed.a, 'Complex Array Test', 'String Test');
+  assert.strictEqual(parsed?.cUnderscore?.aUnderscore, 221.13900756835938, 'Float Test');
+  assert.deepEqual(parsed?.cUnderscore?.bUnderscore, [-700, -600, -500, -400, -300, -200, -100, 0, 100, 200, 300, 400, 500, 600, 700], 'Array of signed integers');
+  assert.strictEqual(parsed?.cUnderscore.d?.[0].dOuter[0].d[1].a, 123000987.9876, 'Float in deep');
+  assert.deepEqual(parsed?.cUnderscore?.d[0].dOuter?.[0]?.e, {
+    a: 987654321.9876,
+    b: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
+    c: 19,
+    dUnderscore: '9007199254741000',
+  }, 'Object in deep');
+  assert.deepEqual(parsed?.cUnderscore.g, ['0', '0'], 'Last object');
+
+  console.log('Arrays test: completed successfully');
+}
diff --git a/tests/ts/TypeScriptTest.py b/tests/ts/TypeScriptTest.py
index c95ed72..bb8dfca 100755
--- a/tests/ts/TypeScriptTest.py
+++ b/tests/ts/TypeScriptTest.py
@@ -61,7 +61,7 @@
 
 print("Invoking flatc...")
 flatc(
-    options=["--ts", "--gen-name-strings", "--gen-mutable", "--gen-object-api"],
+    options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api"],
     schema="../monster_test.fbs",
     include="../include_test",
 )
@@ -74,18 +74,18 @@
 )
 
 flatc(
-    options=["--ts", "--gen-name-strings", "--gen-mutable", "--gen-object-api"],
+    options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api"],
     schema="../union_vector/union_vector.fbs",
     prefix="union_vector",
 )
 
 flatc(
-    options=["--ts", "--gen-name-strings"],
+    options=["--ts", "--reflect-names", "--gen-name-strings"],
     schema="../optional_scalars.fbs",
 )
 
 flatc(
-    options=["--ts", "--gen-name-strings", "--gen-mutable", "--gen-object-api"],
+    options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api"],
     schema=[
         "typescript_keywords.fbs",
         "test_dir/typescript_include.fbs",
@@ -96,8 +96,15 @@
 )
 
 flatc(
+    options=["--ts", "--reflect-names", "--ts-flat-files", "--gen-name-strings", "--gen-object-api"],
+    schema="arrays_test_complex/arrays_test_complex.fbs",
+    prefix="arrays_test_complex"
+)
+
+flatc(
     options=[
         "--ts",
+        "--reflect-names",
         "--gen-name-strings",
         "--gen-mutable",
         "--gen-object-api",
@@ -120,4 +127,5 @@
 print("Running TypeScript Tests...")
 check_call(NODE_CMD + ["JavaScriptTest"])
 check_call(NODE_CMD + ["JavaScriptUnionVectorTest"])
-check_call(NODE_CMD + ["JavaScriptFlexBuffersTest"])
\ No newline at end of file
+check_call(NODE_CMD + ["JavaScriptFlexBuffersTest"])
+check_call(NODE_CMD + ["JavaScriptComplexArraysTest"])
\ No newline at end of file
diff --git a/tests/ts/arrays_test_complex/arrays_test_complex.fbs b/tests/ts/arrays_test_complex/arrays_test_complex.fbs
new file mode 100644
index 0000000..3ef5915
--- /dev/null
+++ b/tests/ts/arrays_test_complex/arrays_test_complex.fbs
@@ -0,0 +1,46 @@
+namespace MyGame.Example;
+
+enum TestEnum : byte { A, B, C }
+
+struct InnerStruct {
+  a:float64;
+  b:[ubyte:13];
+  c:int8;
+  d_underscore:int64;
+}
+
+struct OuterStruct {
+  a:bool;
+  b:double;
+  c_underscore:InnerStruct;
+  d:[InnerStruct:3];
+  e:InnerStruct;
+  f:[float64:4];
+}
+
+struct NestedStruct{
+  a:[int:2];
+  b:TestEnum;
+  c_underscore:[TestEnum:2];
+  d_outer:[OuterStruct:5];
+  e:[int64:2];
+}
+
+struct ArrayStruct{
+  a_underscore:float;
+  b_underscore:[int:0xF];
+  c:byte;
+  d:[NestedStruct:2];
+  e:int32;
+  f:[OuterStruct:2];
+  g:[int64:2];
+}
+
+table ArrayTable{
+  a:string;
+  c_underscore:ArrayStruct;
+}
+
+root_type ArrayTable;
+file_identifier "RHUB";
+file_extension "mon";
\ No newline at end of file
diff --git a/tests/ts/arrays_test_complex/arrays_test_complex_generated.js b/tests/ts/arrays_test_complex/arrays_test_complex_generated.js
new file mode 100644
index 0000000..7530e84
--- /dev/null
+++ b/tests/ts/arrays_test_complex/arrays_test_complex_generated.js
@@ -0,0 +1,409 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+export var TestEnum;
+(function (TestEnum) {
+    TestEnum[TestEnum["A"] = 0] = "A";
+    TestEnum[TestEnum["B"] = 1] = "B";
+    TestEnum[TestEnum["C"] = 2] = "C";
+})(TestEnum || (TestEnum = {}));
+export class InnerStruct {
+    constructor() {
+        this.bb = null;
+        this.bb_pos = 0;
+    }
+    __init(i, bb) {
+        this.bb_pos = i;
+        this.bb = bb;
+        return this;
+    }
+    a() {
+        return this.bb.readFloat64(this.bb_pos);
+    }
+    b(index) {
+        return this.bb.readUint8(this.bb_pos + 8 + index);
+    }
+    c() {
+        return this.bb.readInt8(this.bb_pos + 21);
+    }
+    dUnderscore() {
+        return this.bb.readInt64(this.bb_pos + 24);
+    }
+    static getFullyQualifiedName() {
+        return 'MyGame_Example_InnerStruct';
+    }
+    static sizeOf() {
+        return 32;
+    }
+    static createInnerStruct(builder, a, b, c, d_underscore) {
+        var _a;
+        builder.prep(8, 32);
+        builder.writeInt64(BigInt(d_underscore !== null && d_underscore !== void 0 ? d_underscore : 0));
+        builder.pad(2);
+        builder.writeInt8(c);
+        for (let i = 12; i >= 0; --i) {
+            builder.writeInt8(((_a = b === null || b === void 0 ? void 0 : b[i]) !== null && _a !== void 0 ? _a : 0));
+        }
+        builder.writeFloat64(a);
+        return builder.offset();
+    }
+    unpack() {
+        return new InnerStructT(this.a(), this.bb.createScalarList(this.b.bind(this), 13), this.c(), this.dUnderscore());
+    }
+    unpackTo(_o) {
+        _o.a = this.a();
+        _o.b = this.bb.createScalarList(this.b.bind(this), 13);
+        _o.c = this.c();
+        _o.dUnderscore = this.dUnderscore();
+    }
+}
+export class InnerStructT {
+    constructor(a = 0.0, b = [], c = 0, dUnderscore = BigInt('0')) {
+        this.a = a;
+        this.b = b;
+        this.c = c;
+        this.dUnderscore = dUnderscore;
+    }
+    pack(builder) {
+        return InnerStruct.createInnerStruct(builder, this.a, this.b, this.c, this.dUnderscore);
+    }
+}
+export class OuterStruct {
+    constructor() {
+        this.bb = null;
+        this.bb_pos = 0;
+    }
+    __init(i, bb) {
+        this.bb_pos = i;
+        this.bb = bb;
+        return this;
+    }
+    a() {
+        return !!this.bb.readInt8(this.bb_pos);
+    }
+    b() {
+        return this.bb.readFloat64(this.bb_pos + 8);
+    }
+    cUnderscore(obj) {
+        return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb);
+    }
+    d(index, obj) {
+        return (obj || new InnerStruct()).__init(this.bb_pos + 48 + index * 32, this.bb);
+    }
+    e(obj) {
+        return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb);
+    }
+    f(index) {
+        return this.bb.readFloat64(this.bb_pos + 176 + index * 8);
+    }
+    static getFullyQualifiedName() {
+        return 'MyGame_Example_OuterStruct';
+    }
+    static sizeOf() {
+        return 208;
+    }
+    static createOuterStruct(builder, a, b, c_underscore_a, c_underscore_b, c_underscore_c, c_underscore_d_underscore, d, e_a, e_b, e_c, e_d_underscore, f) {
+        var _a, _b, _c;
+        builder.prep(8, 208);
+        for (let i = 3; i >= 0; --i) {
+            builder.writeFloat64(((_a = f === null || f === void 0 ? void 0 : f[i]) !== null && _a !== void 0 ? _a : 0));
+        }
+        builder.prep(8, 32);
+        builder.writeInt64(BigInt(e_d_underscore !== null && e_d_underscore !== void 0 ? e_d_underscore : 0));
+        builder.pad(2);
+        builder.writeInt8(e_c);
+        for (let i = 12; i >= 0; --i) {
+            builder.writeInt8(((_b = e_b === null || e_b === void 0 ? void 0 : e_b[i]) !== null && _b !== void 0 ? _b : 0));
+        }
+        builder.writeFloat64(e_a);
+        for (let i = 2; i >= 0; --i) {
+            const item = d === null || d === void 0 ? void 0 : d[i];
+            if (item instanceof InnerStructT) {
+                item.pack(builder);
+                continue;
+            }
+            InnerStruct.createInnerStruct(builder, item === null || item === void 0 ? void 0 : item.a, item === null || item === void 0 ? void 0 : item.b, item === null || item === void 0 ? void 0 : item.c, item === null || item === void 0 ? void 0 : item.dUnderscore);
+        }
+        builder.prep(8, 32);
+        builder.writeInt64(BigInt(c_underscore_d_underscore !== null && c_underscore_d_underscore !== void 0 ? c_underscore_d_underscore : 0));
+        builder.pad(2);
+        builder.writeInt8(c_underscore_c);
+        for (let i = 12; i >= 0; --i) {
+            builder.writeInt8(((_c = c_underscore_b === null || c_underscore_b === void 0 ? void 0 : c_underscore_b[i]) !== null && _c !== void 0 ? _c : 0));
+        }
+        builder.writeFloat64(c_underscore_a);
+        builder.writeFloat64(b);
+        builder.pad(7);
+        builder.writeInt8(Number(Boolean(a)));
+        return builder.offset();
+    }
+    unpack() {
+        return new OuterStructT(this.a(), this.b(), (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null), this.bb.createObjList(this.d.bind(this), 3), (this.e() !== null ? this.e().unpack() : null), this.bb.createScalarList(this.f.bind(this), 4));
+    }
+    unpackTo(_o) {
+        _o.a = this.a();
+        _o.b = this.b();
+        _o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null);
+        _o.d = this.bb.createObjList(this.d.bind(this), 3);
+        _o.e = (this.e() !== null ? this.e().unpack() : null);
+        _o.f = this.bb.createScalarList(this.f.bind(this), 4);
+    }
+}
+export class OuterStructT {
+    constructor(a = false, b = 0.0, cUnderscore = null, d = [], e = null, f = []) {
+        this.a = a;
+        this.b = b;
+        this.cUnderscore = cUnderscore;
+        this.d = d;
+        this.e = e;
+        this.f = f;
+    }
+    pack(builder) {
+        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _p, _q, _r, _s;
+        return OuterStruct.createOuterStruct(builder, this.a, this.b, ((_b = (_a = this.cUnderscore) === null || _a === void 0 ? void 0 : _a.a) !== null && _b !== void 0 ? _b : 0), ((_d = (_c = this.cUnderscore) === null || _c === void 0 ? void 0 : _c.b) !== null && _d !== void 0 ? _d : []), ((_f = (_e = this.cUnderscore) === null || _e === void 0 ? void 0 : _e.c) !== null && _f !== void 0 ? _f : 0), ((_h = (_g = this.cUnderscore) === null || _g === void 0 ? void 0 : _g.dUnderscore) !== null && _h !== void 0 ? _h : BigInt(0)), this.d, ((_k = (_j = this.e) === null || _j === void 0 ? void 0 : _j.a) !== null && _k !== void 0 ? _k : 0), ((_m = (_l = this.e) === null || _l === void 0 ? void 0 : _l.b) !== null && _m !== void 0 ? _m : []), ((_q = (_p = this.e) === null || _p === void 0 ? void 0 : _p.c) !== null && _q !== void 0 ? _q : 0), ((_s = (_r = this.e) === null || _r === void 0 ? void 0 : _r.dUnderscore) !== null && _s !== void 0 ? _s : BigInt(0)), this.f);
+    }
+}
+export class NestedStruct {
+    constructor() {
+        this.bb = null;
+        this.bb_pos = 0;
+    }
+    __init(i, bb) {
+        this.bb_pos = i;
+        this.bb = bb;
+        return this;
+    }
+    a(index) {
+        return this.bb.readInt32(this.bb_pos + 0 + index * 4);
+    }
+    b() {
+        return this.bb.readInt8(this.bb_pos + 8);
+    }
+    cUnderscore(index) {
+        return this.bb.readInt8(this.bb_pos + 9 + index);
+    }
+    dOuter(index, obj) {
+        return (obj || new OuterStruct()).__init(this.bb_pos + 16 + index * 208, this.bb);
+    }
+    e(index) {
+        return this.bb.readInt64(this.bb_pos + 1056 + index * 8);
+    }
+    static getFullyQualifiedName() {
+        return 'MyGame_Example_NestedStruct';
+    }
+    static sizeOf() {
+        return 1072;
+    }
+    static createNestedStruct(builder, a, b, c_underscore, d_outer, e) {
+        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _p, _q, _r, _s, _t, _u, _v;
+        builder.prep(8, 1072);
+        for (let i = 1; i >= 0; --i) {
+            builder.writeInt64(BigInt((_a = e === null || e === void 0 ? void 0 : e[i]) !== null && _a !== void 0 ? _a : 0));
+        }
+        for (let i = 4; i >= 0; --i) {
+            const item = d_outer === null || d_outer === void 0 ? void 0 : d_outer[i];
+            if (item instanceof OuterStructT) {
+                item.pack(builder);
+                continue;
+            }
+            OuterStruct.createOuterStruct(builder, item === null || item === void 0 ? void 0 : item.a, item === null || item === void 0 ? void 0 : item.b, ((_c = (_b = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _b === void 0 ? void 0 : _b.a) !== null && _c !== void 0 ? _c : 0), ((_e = (_d = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _d === void 0 ? void 0 : _d.b) !== null && _e !== void 0 ? _e : []), ((_g = (_f = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _f === void 0 ? void 0 : _f.c) !== null && _g !== void 0 ? _g : 0), ((_j = (_h = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _h === void 0 ? void 0 : _h.dUnderscore) !== null && _j !== void 0 ? _j : BigInt(0)), item === null || item === void 0 ? void 0 : item.d, ((_l = (_k = item === null || item === void 0 ? void 0 : item.e) === null || _k === void 0 ? void 0 : _k.a) !== null && _l !== void 0 ? _l : 0), ((_p = (_m = item === null || item === void 0 ? void 0 : item.e) === null || _m === void 0 ? void 0 : _m.b) !== null && _p !== void 0 ? _p : []), ((_r = (_q = item === null || item === void 0 ? void 0 : item.e) === null || _q === void 0 ? void 0 : _q.c) !== null && _r !== void 0 ? _r : 0), ((_t = (_s = item === null || item === void 0 ? void 0 : item.e) === null || _s === void 0 ? void 0 : _s.dUnderscore) !== null && _t !== void 0 ? _t : BigInt(0)), item === null || item === void 0 ? void 0 : item.f);
+        }
+        builder.pad(5);
+        for (let i = 1; i >= 0; --i) {
+            builder.writeInt8(((_u = c_underscore === null || c_underscore === void 0 ? void 0 : c_underscore[i]) !== null && _u !== void 0 ? _u : 0));
+        }
+        builder.writeInt8(b);
+        for (let i = 1; i >= 0; --i) {
+            builder.writeInt32(((_v = a === null || a === void 0 ? void 0 : a[i]) !== null && _v !== void 0 ? _v : 0));
+        }
+        return builder.offset();
+    }
+    unpack() {
+        return new NestedStructT(this.bb.createScalarList(this.a.bind(this), 2), this.b(), this.bb.createScalarList(this.cUnderscore.bind(this), 2), this.bb.createObjList(this.dOuter.bind(this), 5), this.bb.createScalarList(this.e.bind(this), 2));
+    }
+    unpackTo(_o) {
+        _o.a = this.bb.createScalarList(this.a.bind(this), 2);
+        _o.b = this.b();
+        _o.cUnderscore = this.bb.createScalarList(this.cUnderscore.bind(this), 2);
+        _o.dOuter = this.bb.createObjList(this.dOuter.bind(this), 5);
+        _o.e = this.bb.createScalarList(this.e.bind(this), 2);
+    }
+}
+export class NestedStructT {
+    constructor(a = [], b = TestEnum.A, cUnderscore = [TestEnum.A, TestEnum.A], dOuter = [], e = []) {
+        this.a = a;
+        this.b = b;
+        this.cUnderscore = cUnderscore;
+        this.dOuter = dOuter;
+        this.e = e;
+    }
+    pack(builder) {
+        return NestedStruct.createNestedStruct(builder, this.a, this.b, this.cUnderscore, this.dOuter, this.e);
+    }
+}
+export class ArrayStruct {
+    constructor() {
+        this.bb = null;
+        this.bb_pos = 0;
+    }
+    __init(i, bb) {
+        this.bb_pos = i;
+        this.bb = bb;
+        return this;
+    }
+    aUnderscore() {
+        return this.bb.readFloat32(this.bb_pos);
+    }
+    bUnderscore(index) {
+        return this.bb.readInt32(this.bb_pos + 4 + index * 4);
+    }
+    c() {
+        return this.bb.readInt8(this.bb_pos + 64);
+    }
+    d(index, obj) {
+        return (obj || new NestedStruct()).__init(this.bb_pos + 72 + index * 1072, this.bb);
+    }
+    e() {
+        return this.bb.readInt32(this.bb_pos + 2216);
+    }
+    f(index, obj) {
+        return (obj || new OuterStruct()).__init(this.bb_pos + 2224 + index * 208, this.bb);
+    }
+    g(index) {
+        return this.bb.readInt64(this.bb_pos + 2640 + index * 8);
+    }
+    static getFullyQualifiedName() {
+        return 'MyGame_Example_ArrayStruct';
+    }
+    static sizeOf() {
+        return 2656;
+    }
+    static createArrayStruct(builder, a_underscore, b_underscore, c, d, e, f, g) {
+        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _p, _q, _r, _s, _t, _u;
+        builder.prep(8, 2656);
+        for (let i = 1; i >= 0; --i) {
+            builder.writeInt64(BigInt((_a = g === null || g === void 0 ? void 0 : g[i]) !== null && _a !== void 0 ? _a : 0));
+        }
+        for (let i = 1; i >= 0; --i) {
+            const item = f === null || f === void 0 ? void 0 : f[i];
+            if (item instanceof OuterStructT) {
+                item.pack(builder);
+                continue;
+            }
+            OuterStruct.createOuterStruct(builder, item === null || item === void 0 ? void 0 : item.a, item === null || item === void 0 ? void 0 : item.b, ((_c = (_b = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _b === void 0 ? void 0 : _b.a) !== null && _c !== void 0 ? _c : 0), ((_e = (_d = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _d === void 0 ? void 0 : _d.b) !== null && _e !== void 0 ? _e : []), ((_g = (_f = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _f === void 0 ? void 0 : _f.c) !== null && _g !== void 0 ? _g : 0), ((_j = (_h = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _h === void 0 ? void 0 : _h.dUnderscore) !== null && _j !== void 0 ? _j : BigInt(0)), item === null || item === void 0 ? void 0 : item.d, ((_l = (_k = item === null || item === void 0 ? void 0 : item.e) === null || _k === void 0 ? void 0 : _k.a) !== null && _l !== void 0 ? _l : 0), ((_p = (_m = item === null || item === void 0 ? void 0 : item.e) === null || _m === void 0 ? void 0 : _m.b) !== null && _p !== void 0 ? _p : []), ((_r = (_q = item === null || item === void 0 ? void 0 : item.e) === null || _q === void 0 ? void 0 : _q.c) !== null && _r !== void 0 ? _r : 0), ((_t = (_s = item === null || item === void 0 ? void 0 : item.e) === null || _s === void 0 ? void 0 : _s.dUnderscore) !== null && _t !== void 0 ? _t : BigInt(0)), item === null || item === void 0 ? void 0 : item.f);
+        }
+        builder.pad(4);
+        builder.writeInt32(e);
+        for (let i = 1; i >= 0; --i) {
+            const item = d === null || d === void 0 ? void 0 : d[i];
+            if (item instanceof NestedStructT) {
+                item.pack(builder);
+                continue;
+            }
+            NestedStruct.createNestedStruct(builder, item === null || item === void 0 ? void 0 : item.a, item === null || item === void 0 ? void 0 : item.b, item === null || item === void 0 ? void 0 : item.cUnderscore, item === null || item === void 0 ? void 0 : item.dOuter, item === null || item === void 0 ? void 0 : item.e);
+        }
+        builder.pad(7);
+        builder.writeInt8(c);
+        for (let i = 14; i >= 0; --i) {
+            builder.writeInt32(((_u = b_underscore === null || b_underscore === void 0 ? void 0 : b_underscore[i]) !== null && _u !== void 0 ? _u : 0));
+        }
+        builder.writeFloat32(a_underscore);
+        return builder.offset();
+    }
+    unpack() {
+        return new ArrayStructT(this.aUnderscore(), this.bb.createScalarList(this.bUnderscore.bind(this), 15), this.c(), this.bb.createObjList(this.d.bind(this), 2), this.e(), this.bb.createObjList(this.f.bind(this), 2), this.bb.createScalarList(this.g.bind(this), 2));
+    }
+    unpackTo(_o) {
+        _o.aUnderscore = this.aUnderscore();
+        _o.bUnderscore = this.bb.createScalarList(this.bUnderscore.bind(this), 15);
+        _o.c = this.c();
+        _o.d = this.bb.createObjList(this.d.bind(this), 2);
+        _o.e = this.e();
+        _o.f = this.bb.createObjList(this.f.bind(this), 2);
+        _o.g = this.bb.createScalarList(this.g.bind(this), 2);
+    }
+}
+export class ArrayStructT {
+    constructor(aUnderscore = 0.0, bUnderscore = [], c = 0, d = [], e = 0, f = [], g = []) {
+        this.aUnderscore = aUnderscore;
+        this.bUnderscore = bUnderscore;
+        this.c = c;
+        this.d = d;
+        this.e = e;
+        this.f = f;
+        this.g = g;
+    }
+    pack(builder) {
+        return ArrayStruct.createArrayStruct(builder, this.aUnderscore, this.bUnderscore, this.c, this.d, this.e, this.f, this.g);
+    }
+}
+export class ArrayTable {
+    constructor() {
+        this.bb = null;
+        this.bb_pos = 0;
+    }
+    __init(i, bb) {
+        this.bb_pos = i;
+        this.bb = bb;
+        return this;
+    }
+    static getRootAsArrayTable(bb, obj) {
+        return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    static getSizePrefixedRootAsArrayTable(bb, obj) {
+        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+        return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    static bufferHasIdentifier(bb) {
+        return bb.__has_identifier('RHUB');
+    }
+    a(optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 4);
+        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+    }
+    cUnderscore(obj) {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? (obj || new ArrayStruct()).__init(this.bb_pos + offset, this.bb) : null;
+    }
+    static getFullyQualifiedName() {
+        return 'MyGame_Example_ArrayTable';
+    }
+    static startArrayTable(builder) {
+        builder.startObject(2);
+    }
+    static addA(builder, aOffset) {
+        builder.addFieldOffset(0, aOffset, 0);
+    }
+    static addCUnderscore(builder, cUnderscoreOffset) {
+        builder.addFieldStruct(1, cUnderscoreOffset, 0);
+    }
+    static endArrayTable(builder) {
+        const offset = builder.endObject();
+        return offset;
+    }
+    static finishArrayTableBuffer(builder, offset) {
+        builder.finish(offset, 'RHUB');
+    }
+    static finishSizePrefixedArrayTableBuffer(builder, offset) {
+        builder.finish(offset, 'RHUB', true);
+    }
+    unpack() {
+        return new ArrayTableT(this.a(), (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null));
+    }
+    unpackTo(_o) {
+        _o.a = this.a();
+        _o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null);
+    }
+}
+export class ArrayTableT {
+    constructor(a = null, cUnderscore = null) {
+        this.a = a;
+        this.cUnderscore = cUnderscore;
+    }
+    pack(builder) {
+        const a = (this.a !== null ? builder.createString(this.a) : 0);
+        ArrayTable.startArrayTable(builder);
+        ArrayTable.addA(builder, a);
+        ArrayTable.addCUnderscore(builder, (this.cUnderscore !== null ? this.cUnderscore.pack(builder) : 0));
+        return ArrayTable.endArrayTable(builder);
+    }
+}
diff --git a/tests/ts/arrays_test_complex/arrays_test_complex_generated.ts b/tests/ts/arrays_test_complex/arrays_test_complex_generated.ts
new file mode 100644
index 0000000..eea0ed9
--- /dev/null
+++ b/tests/ts/arrays_test_complex/arrays_test_complex_generated.ts
@@ -0,0 +1,626 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+export enum TestEnum {
+  A = 0,
+  B = 1,
+  C = 2
+}
+
+export class InnerStruct implements flatbuffers.IUnpackableObject<InnerStructT> {
+  bb: flatbuffers.ByteBuffer|null = null;
+  bb_pos = 0;
+  __init(i:number, bb:flatbuffers.ByteBuffer):InnerStruct {
+  this.bb_pos = i;
+  this.bb = bb;
+  return this;
+}
+
+a():number {
+  return this.bb!.readFloat64(this.bb_pos);
+}
+
+b(index: number):number|null {
+    return this.bb!.readUint8(this.bb_pos + 8 + index);
+}
+
+c():number {
+  return this.bb!.readInt8(this.bb_pos + 21);
+}
+
+dUnderscore():bigint {
+  return this.bb!.readInt64(this.bb_pos + 24);
+}
+
+static getFullyQualifiedName():string {
+  return 'MyGame_Example_InnerStruct';
+}
+
+static sizeOf():number {
+  return 32;
+}
+
+static createInnerStruct(builder:flatbuffers.Builder, a: number, b: number[]|null, c: number, d_underscore: bigint):flatbuffers.Offset {
+  builder.prep(8, 32);
+  builder.writeInt64(BigInt(d_underscore ?? 0));
+  builder.pad(2);
+  builder.writeInt8(c);
+
+  for (let i = 12; i >= 0; --i) {
+    builder.writeInt8((b?.[i] ?? 0));
+
+  }
+
+  builder.writeFloat64(a);
+  return builder.offset();
+}
+
+
+unpack(): InnerStructT {
+  return new InnerStructT(
+    this.a(),
+    this.bb!.createScalarList<number>(this.b.bind(this), 13),
+    this.c(),
+    this.dUnderscore()
+  );
+}
+
+
+unpackTo(_o: InnerStructT): void {
+  _o.a = this.a();
+  _o.b = this.bb!.createScalarList<number>(this.b.bind(this), 13);
+  _o.c = this.c();
+  _o.dUnderscore = this.dUnderscore();
+}
+}
+
+export class InnerStructT implements flatbuffers.IGeneratedObject {
+constructor(
+  public a: number = 0.0,
+  public b: (number)[] = [],
+  public c: number = 0,
+  public dUnderscore: bigint = BigInt('0')
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+  return InnerStruct.createInnerStruct(builder,
+    this.a,
+    this.b,
+    this.c,
+    this.dUnderscore
+  );
+}
+}
+
+export class OuterStruct implements flatbuffers.IUnpackableObject<OuterStructT> {
+  bb: flatbuffers.ByteBuffer|null = null;
+  bb_pos = 0;
+  __init(i:number, bb:flatbuffers.ByteBuffer):OuterStruct {
+  this.bb_pos = i;
+  this.bb = bb;
+  return this;
+}
+
+a():boolean {
+  return !!this.bb!.readInt8(this.bb_pos);
+}
+
+b():number {
+  return this.bb!.readFloat64(this.bb_pos + 8);
+}
+
+cUnderscore(obj?:InnerStruct):InnerStruct|null {
+  return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb!);
+}
+
+d(index: number, obj?:InnerStruct):InnerStruct|null {
+    return (obj || new InnerStruct()).__init(this.bb_pos + 48 + index * 32, this.bb!);
+}
+
+e(obj?:InnerStruct):InnerStruct|null {
+  return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb!);
+}
+
+f(index: number):number|null {
+    return this.bb!.readFloat64(this.bb_pos + 176 + index * 8);
+}
+
+static getFullyQualifiedName():string {
+  return 'MyGame_Example_OuterStruct';
+}
+
+static sizeOf():number {
+  return 208;
+}
+
+static createOuterStruct(builder:flatbuffers.Builder, a: boolean, b: number, c_underscore_a: number, c_underscore_b: number[]|null, c_underscore_c: number, c_underscore_d_underscore: bigint, d: (any|InnerStructT)[]|null, e_a: number, e_b: number[]|null, e_c: number, e_d_underscore: bigint, f: number[]|null):flatbuffers.Offset {
+  builder.prep(8, 208);
+
+  for (let i = 3; i >= 0; --i) {
+    builder.writeFloat64((f?.[i] ?? 0));
+
+  }
+
+  builder.prep(8, 32);
+  builder.writeInt64(BigInt(e_d_underscore ?? 0));
+  builder.pad(2);
+  builder.writeInt8(e_c);
+
+  for (let i = 12; i >= 0; --i) {
+    builder.writeInt8((e_b?.[i] ?? 0));
+
+  }
+
+  builder.writeFloat64(e_a);
+
+  for (let i = 2; i >= 0; --i) {
+    const item = d?.[i];
+
+    if (item instanceof InnerStructT) {
+      item.pack(builder);
+      continue;
+    }
+
+    InnerStruct.createInnerStruct(builder,
+    item?.a,
+    item?.b,
+    item?.c,
+    item?.dUnderscore
+    );
+  }
+
+  builder.prep(8, 32);
+  builder.writeInt64(BigInt(c_underscore_d_underscore ?? 0));
+  builder.pad(2);
+  builder.writeInt8(c_underscore_c);
+
+  for (let i = 12; i >= 0; --i) {
+    builder.writeInt8((c_underscore_b?.[i] ?? 0));
+
+  }
+
+  builder.writeFloat64(c_underscore_a);
+  builder.writeFloat64(b);
+  builder.pad(7);
+  builder.writeInt8(Number(Boolean(a)));
+  return builder.offset();
+}
+
+
+unpack(): OuterStructT {
+  return new OuterStructT(
+    this.a(),
+    this.b(),
+    (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null),
+    this.bb!.createObjList<InnerStruct, InnerStructT>(this.d.bind(this), 3),
+    (this.e() !== null ? this.e()!.unpack() : null),
+    this.bb!.createScalarList<number>(this.f.bind(this), 4)
+  );
+}
+
+
+unpackTo(_o: OuterStructT): void {
+  _o.a = this.a();
+  _o.b = this.b();
+  _o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null);
+  _o.d = this.bb!.createObjList<InnerStruct, InnerStructT>(this.d.bind(this), 3);
+  _o.e = (this.e() !== null ? this.e()!.unpack() : null);
+  _o.f = this.bb!.createScalarList<number>(this.f.bind(this), 4);
+}
+}
+
+export class OuterStructT implements flatbuffers.IGeneratedObject {
+constructor(
+  public a: boolean = false,
+  public b: number = 0.0,
+  public cUnderscore: InnerStructT|null = null,
+  public d: (InnerStructT)[] = [],
+  public e: InnerStructT|null = null,
+  public f: (number)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+  return OuterStruct.createOuterStruct(builder,
+    this.a,
+    this.b,
+    (this.cUnderscore?.a ?? 0),
+    (this.cUnderscore?.b ?? []),
+    (this.cUnderscore?.c ?? 0),
+    (this.cUnderscore?.dUnderscore ?? BigInt(0)),
+    this.d,
+    (this.e?.a ?? 0),
+    (this.e?.b ?? []),
+    (this.e?.c ?? 0),
+    (this.e?.dUnderscore ?? BigInt(0)),
+    this.f
+  );
+}
+}
+
+export class NestedStruct implements flatbuffers.IUnpackableObject<NestedStructT> {
+  bb: flatbuffers.ByteBuffer|null = null;
+  bb_pos = 0;
+  __init(i:number, bb:flatbuffers.ByteBuffer):NestedStruct {
+  this.bb_pos = i;
+  this.bb = bb;
+  return this;
+}
+
+a(index: number):number|null {
+    return this.bb!.readInt32(this.bb_pos + 0 + index * 4);
+}
+
+b():TestEnum {
+  return this.bb!.readInt8(this.bb_pos + 8);
+}
+
+cUnderscore(index: number):TestEnum|null {
+    return this.bb!.readInt8(this.bb_pos + 9 + index);
+}
+
+dOuter(index: number, obj?:OuterStruct):OuterStruct|null {
+    return (obj || new OuterStruct()).__init(this.bb_pos + 16 + index * 208, this.bb!);
+}
+
+e(index: number):bigint|null {
+    return this.bb!.readInt64(this.bb_pos + 1056 + index * 8);
+}
+
+static getFullyQualifiedName():string {
+  return 'MyGame_Example_NestedStruct';
+}
+
+static sizeOf():number {
+  return 1072;
+}
+
+static createNestedStruct(builder:flatbuffers.Builder, a: number[]|null, b: TestEnum, c_underscore: number[]|null, d_outer: (any|OuterStructT)[]|null, e: bigint[]|null):flatbuffers.Offset {
+  builder.prep(8, 1072);
+
+  for (let i = 1; i >= 0; --i) {
+    builder.writeInt64(BigInt(e?.[i] ?? 0));
+  }
+
+
+  for (let i = 4; i >= 0; --i) {
+    const item = d_outer?.[i];
+
+    if (item instanceof OuterStructT) {
+      item.pack(builder);
+      continue;
+    }
+
+    OuterStruct.createOuterStruct(builder,
+    item?.a,
+    item?.b,
+    (item?.cUnderscore?.a ?? 0),
+    (item?.cUnderscore?.b ?? []),
+    (item?.cUnderscore?.c ?? 0),
+    (item?.cUnderscore?.dUnderscore ?? BigInt(0)),
+    item?.d,
+    (item?.e?.a ?? 0),
+    (item?.e?.b ?? []),
+    (item?.e?.c ?? 0),
+    (item?.e?.dUnderscore ?? BigInt(0)),
+    item?.f
+    );
+  }
+
+  builder.pad(5);
+
+  for (let i = 1; i >= 0; --i) {
+    builder.writeInt8((c_underscore?.[i] ?? 0));
+
+  }
+
+  builder.writeInt8(b);
+
+  for (let i = 1; i >= 0; --i) {
+    builder.writeInt32((a?.[i] ?? 0));
+
+  }
+
+  return builder.offset();
+}
+
+
+unpack(): NestedStructT {
+  return new NestedStructT(
+    this.bb!.createScalarList<number>(this.a.bind(this), 2),
+    this.b(),
+    this.bb!.createScalarList<TestEnum>(this.cUnderscore.bind(this), 2),
+    this.bb!.createObjList<OuterStruct, OuterStructT>(this.dOuter.bind(this), 5),
+    this.bb!.createScalarList<bigint>(this.e.bind(this), 2)
+  );
+}
+
+
+unpackTo(_o: NestedStructT): void {
+  _o.a = this.bb!.createScalarList<number>(this.a.bind(this), 2);
+  _o.b = this.b();
+  _o.cUnderscore = this.bb!.createScalarList<TestEnum>(this.cUnderscore.bind(this), 2);
+  _o.dOuter = this.bb!.createObjList<OuterStruct, OuterStructT>(this.dOuter.bind(this), 5);
+  _o.e = this.bb!.createScalarList<bigint>(this.e.bind(this), 2);
+}
+}
+
+export class NestedStructT implements flatbuffers.IGeneratedObject {
+constructor(
+  public a: (number)[] = [],
+  public b: TestEnum = TestEnum.A,
+  public cUnderscore: (TestEnum)[] = [TestEnum.A, TestEnum.A],
+  public dOuter: (OuterStructT)[] = [],
+  public e: (bigint)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+  return NestedStruct.createNestedStruct(builder,
+    this.a,
+    this.b,
+    this.cUnderscore,
+    this.dOuter,
+    this.e
+  );
+}
+}
+
+export class ArrayStruct implements flatbuffers.IUnpackableObject<ArrayStructT> {
+  bb: flatbuffers.ByteBuffer|null = null;
+  bb_pos = 0;
+  __init(i:number, bb:flatbuffers.ByteBuffer):ArrayStruct {
+  this.bb_pos = i;
+  this.bb = bb;
+  return this;
+}
+
+aUnderscore():number {
+  return this.bb!.readFloat32(this.bb_pos);
+}
+
+bUnderscore(index: number):number|null {
+    return this.bb!.readInt32(this.bb_pos + 4 + index * 4);
+}
+
+c():number {
+  return this.bb!.readInt8(this.bb_pos + 64);
+}
+
+d(index: number, obj?:NestedStruct):NestedStruct|null {
+    return (obj || new NestedStruct()).__init(this.bb_pos + 72 + index * 1072, this.bb!);
+}
+
+e():number {
+  return this.bb!.readInt32(this.bb_pos + 2216);
+}
+
+f(index: number, obj?:OuterStruct):OuterStruct|null {
+    return (obj || new OuterStruct()).__init(this.bb_pos + 2224 + index * 208, this.bb!);
+}
+
+g(index: number):bigint|null {
+    return this.bb!.readInt64(this.bb_pos + 2640 + index * 8);
+}
+
+static getFullyQualifiedName():string {
+  return 'MyGame_Example_ArrayStruct';
+}
+
+static sizeOf():number {
+  return 2656;
+}
+
+static createArrayStruct(builder:flatbuffers.Builder, a_underscore: number, b_underscore: number[]|null, c: number, d: (any|NestedStructT)[]|null, e: number, f: (any|OuterStructT)[]|null, g: bigint[]|null):flatbuffers.Offset {
+  builder.prep(8, 2656);
+
+  for (let i = 1; i >= 0; --i) {
+    builder.writeInt64(BigInt(g?.[i] ?? 0));
+  }
+
+
+  for (let i = 1; i >= 0; --i) {
+    const item = f?.[i];
+
+    if (item instanceof OuterStructT) {
+      item.pack(builder);
+      continue;
+    }
+
+    OuterStruct.createOuterStruct(builder,
+    item?.a,
+    item?.b,
+    (item?.cUnderscore?.a ?? 0),
+    (item?.cUnderscore?.b ?? []),
+    (item?.cUnderscore?.c ?? 0),
+    (item?.cUnderscore?.dUnderscore ?? BigInt(0)),
+    item?.d,
+    (item?.e?.a ?? 0),
+    (item?.e?.b ?? []),
+    (item?.e?.c ?? 0),
+    (item?.e?.dUnderscore ?? BigInt(0)),
+    item?.f
+    );
+  }
+
+  builder.pad(4);
+  builder.writeInt32(e);
+
+  for (let i = 1; i >= 0; --i) {
+    const item = d?.[i];
+
+    if (item instanceof NestedStructT) {
+      item.pack(builder);
+      continue;
+    }
+
+    NestedStruct.createNestedStruct(builder,
+    item?.a,
+    item?.b,
+    item?.cUnderscore,
+    item?.dOuter,
+    item?.e
+    );
+  }
+
+  builder.pad(7);
+  builder.writeInt8(c);
+
+  for (let i = 14; i >= 0; --i) {
+    builder.writeInt32((b_underscore?.[i] ?? 0));
+
+  }
+
+  builder.writeFloat32(a_underscore);
+  return builder.offset();
+}
+
+
+unpack(): ArrayStructT {
+  return new ArrayStructT(
+    this.aUnderscore(),
+    this.bb!.createScalarList<number>(this.bUnderscore.bind(this), 15),
+    this.c(),
+    this.bb!.createObjList<NestedStruct, NestedStructT>(this.d.bind(this), 2),
+    this.e(),
+    this.bb!.createObjList<OuterStruct, OuterStructT>(this.f.bind(this), 2),
+    this.bb!.createScalarList<bigint>(this.g.bind(this), 2)
+  );
+}
+
+
+unpackTo(_o: ArrayStructT): void {
+  _o.aUnderscore = this.aUnderscore();
+  _o.bUnderscore = this.bb!.createScalarList<number>(this.bUnderscore.bind(this), 15);
+  _o.c = this.c();
+  _o.d = this.bb!.createObjList<NestedStruct, NestedStructT>(this.d.bind(this), 2);
+  _o.e = this.e();
+  _o.f = this.bb!.createObjList<OuterStruct, OuterStructT>(this.f.bind(this), 2);
+  _o.g = this.bb!.createScalarList<bigint>(this.g.bind(this), 2);
+}
+}
+
+export class ArrayStructT implements flatbuffers.IGeneratedObject {
+constructor(
+  public aUnderscore: number = 0.0,
+  public bUnderscore: (number)[] = [],
+  public c: number = 0,
+  public d: (NestedStructT)[] = [],
+  public e: number = 0,
+  public f: (OuterStructT)[] = [],
+  public g: (bigint)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+  return ArrayStruct.createArrayStruct(builder,
+    this.aUnderscore,
+    this.bUnderscore,
+    this.c,
+    this.d,
+    this.e,
+    this.f,
+    this.g
+  );
+}
+}
+
+export class ArrayTable implements flatbuffers.IUnpackableObject<ArrayTableT> {
+  bb: flatbuffers.ByteBuffer|null = null;
+  bb_pos = 0;
+  __init(i:number, bb:flatbuffers.ByteBuffer):ArrayTable {
+  this.bb_pos = i;
+  this.bb = bb;
+  return this;
+}
+
+static getRootAsArrayTable(bb:flatbuffers.ByteBuffer, obj?:ArrayTable):ArrayTable {
+  return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsArrayTable(bb:flatbuffers.ByteBuffer, obj?:ArrayTable):ArrayTable {
+  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+  return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
+  return bb.__has_identifier('RHUB');
+}
+
+a():string|null
+a(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+a(optionalEncoding?:any):string|Uint8Array|null {
+  const offset = this.bb!.__offset(this.bb_pos, 4);
+  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+cUnderscore(obj?:ArrayStruct):ArrayStruct|null {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  return offset ? (obj || new ArrayStruct()).__init(this.bb_pos + offset, this.bb!) : null;
+}
+
+static getFullyQualifiedName():string {
+  return 'MyGame_Example_ArrayTable';
+}
+
+static startArrayTable(builder:flatbuffers.Builder) {
+  builder.startObject(2);
+}
+
+static addA(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(0, aOffset, 0);
+}
+
+static addCUnderscore(builder:flatbuffers.Builder, cUnderscoreOffset:flatbuffers.Offset) {
+  builder.addFieldStruct(1, cUnderscoreOffset, 0);
+}
+
+static endArrayTable(builder:flatbuffers.Builder):flatbuffers.Offset {
+  const offset = builder.endObject();
+  return offset;
+}
+
+static finishArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+  builder.finish(offset, 'RHUB');
+}
+
+static finishSizePrefixedArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+  builder.finish(offset, 'RHUB', true);
+}
+
+
+unpack(): ArrayTableT {
+  return new ArrayTableT(
+    this.a(),
+    (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null)
+  );
+}
+
+
+unpackTo(_o: ArrayTableT): void {
+  _o.a = this.a();
+  _o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null);
+}
+}
+
+export class ArrayTableT implements flatbuffers.IGeneratedObject {
+constructor(
+  public a: string|Uint8Array|null = null,
+  public cUnderscore: ArrayStructT|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+  const a = (this.a !== null ? builder.createString(this.a!) : 0);
+
+  ArrayTable.startArrayTable(builder);
+  ArrayTable.addA(builder, a);
+  ArrayTable.addCUnderscore(builder, (this.cUnderscore !== null ? this.cUnderscore!.pack(builder) : 0));
+
+  return ArrayTable.endArrayTable(builder);
+}
+}
+
diff --git a/tests/ts/monsterdata_javascript_wire.mon b/tests/ts/monsterdata_javascript_wire.mon
index c6020a2..8e270b3 100644
--- a/tests/ts/monsterdata_javascript_wire.mon
+++ b/tests/ts/monsterdata_javascript_wire.mon
Binary files differ
diff --git a/tests/ts/my-game/example/ability.ts b/tests/ts/my-game/example/ability.ts
index 36b0eb8..b0bea8f 100644
--- a/tests/ts/my-game/example/ability.ts
+++ b/tests/ts/my-game/example/ability.ts
@@ -4,7 +4,7 @@
 
 
 
-export class Ability {
+export class Ability implements flatbuffers.IUnpackableObject<AbilityT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Ability {
@@ -61,7 +61,7 @@
 }
 }
 
-export class AbilityT {
+export class AbilityT implements flatbuffers.IGeneratedObject {
 constructor(
   public id: number = 0,
   public distance: number = 0
diff --git a/tests/ts/my-game/example/monster.js b/tests/ts/my-game/example/monster.js
index e4ef970..97c9399 100644
--- a/tests/ts/my-game/example/monster.js
+++ b/tests/ts/my-game/example/monster.js
@@ -526,11 +526,95 @@
         this.bb.writeUint64(this.bb_pos + offset, value);
         return true;
     }
+    nanDefault() {
+        const offset = this.bb.__offset(this.bb_pos, 112);
+        return offset ? this.bb.readFloat32(this.bb_pos + offset) : NaN;
+    }
+    mutate_nan_default(value) {
+        const offset = this.bb.__offset(this.bb_pos, 112);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeFloat32(this.bb_pos + offset, value);
+        return true;
+    }
+    infDefault() {
+        const offset = this.bb.__offset(this.bb_pos, 114);
+        return offset ? this.bb.readFloat32(this.bb_pos + offset) : Infinity;
+    }
+    mutate_inf_default(value) {
+        const offset = this.bb.__offset(this.bb_pos, 114);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeFloat32(this.bb_pos + offset, value);
+        return true;
+    }
+    positiveInfDefault() {
+        const offset = this.bb.__offset(this.bb_pos, 116);
+        return offset ? this.bb.readFloat32(this.bb_pos + offset) : Infinity;
+    }
+    mutate_positive_inf_default(value) {
+        const offset = this.bb.__offset(this.bb_pos, 116);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeFloat32(this.bb_pos + offset, value);
+        return true;
+    }
+    infinityDefault() {
+        const offset = this.bb.__offset(this.bb_pos, 118);
+        return offset ? this.bb.readFloat32(this.bb_pos + offset) : Infinity;
+    }
+    mutate_infinity_default(value) {
+        const offset = this.bb.__offset(this.bb_pos, 118);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeFloat32(this.bb_pos + offset, value);
+        return true;
+    }
+    positiveInfinityDefault() {
+        const offset = this.bb.__offset(this.bb_pos, 120);
+        return offset ? this.bb.readFloat32(this.bb_pos + offset) : Infinity;
+    }
+    mutate_positive_infinity_default(value) {
+        const offset = this.bb.__offset(this.bb_pos, 120);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeFloat32(this.bb_pos + offset, value);
+        return true;
+    }
+    negativeInfDefault() {
+        const offset = this.bb.__offset(this.bb_pos, 122);
+        return offset ? this.bb.readFloat32(this.bb_pos + offset) : -Infinity;
+    }
+    mutate_negative_inf_default(value) {
+        const offset = this.bb.__offset(this.bb_pos, 122);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeFloat32(this.bb_pos + offset, value);
+        return true;
+    }
+    negativeInfinityDefault() {
+        const offset = this.bb.__offset(this.bb_pos, 124);
+        return offset ? this.bb.readFloat32(this.bb_pos + offset) : -Infinity;
+    }
+    mutate_negative_infinity_default(value) {
+        const offset = this.bb.__offset(this.bb_pos, 124);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeFloat32(this.bb_pos + offset, value);
+        return true;
+    }
     static getFullyQualifiedName() {
         return 'MyGame_Example_Monster';
     }
     static startMonster(builder) {
-        builder.startObject(54);
+        builder.startObject(61);
     }
     static addPos(builder, posOffset) {
         builder.addFieldStruct(0, posOffset, 0);
@@ -870,6 +954,27 @@
     static addLongEnumNormalDefault(builder, longEnumNormalDefault) {
         builder.addFieldInt64(53, longEnumNormalDefault, BigInt('2'));
     }
+    static addNanDefault(builder, nanDefault) {
+        builder.addFieldFloat32(54, nanDefault, NaN);
+    }
+    static addInfDefault(builder, infDefault) {
+        builder.addFieldFloat32(55, infDefault, Infinity);
+    }
+    static addPositiveInfDefault(builder, positiveInfDefault) {
+        builder.addFieldFloat32(56, positiveInfDefault, Infinity);
+    }
+    static addInfinityDefault(builder, infinityDefault) {
+        builder.addFieldFloat32(57, infinityDefault, Infinity);
+    }
+    static addPositiveInfinityDefault(builder, positiveInfinityDefault) {
+        builder.addFieldFloat32(58, positiveInfinityDefault, Infinity);
+    }
+    static addNegativeInfDefault(builder, negativeInfDefault) {
+        builder.addFieldFloat32(59, negativeInfDefault, -Infinity);
+    }
+    static addNegativeInfinityDefault(builder, negativeInfinityDefault) {
+        builder.addFieldFloat32(60, negativeInfinityDefault, -Infinity);
+    }
     static endMonster(builder) {
         const offset = builder.endObject();
         builder.requiredField(offset, 10); // name
@@ -889,24 +994,24 @@
     }
     unpack() {
         return new MonsterT((this.pos() !== null ? this.pos().unpack() : null), this.mana(), this.hp(), this.name(), this.bb.createScalarList(this.inventory.bind(this), this.inventoryLength()), this.color(), this.testType(), (() => {
-            let temp = unionToAny(this.testType(), this.test.bind(this));
+            const temp = unionToAny(this.testType(), this.test.bind(this));
             if (temp === null) {
                 return null;
             }
             return temp.unpack();
         })(), this.bb.createObjList(this.test4.bind(this), this.test4Length()), this.bb.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength()), this.bb.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength()), (this.enemy() !== null ? this.enemy().unpack() : null), this.bb.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength()), (this.testempty() !== null ? this.testempty().unpack() : null), this.testbool(), this.testhashs32Fnv1(), this.testhashu32Fnv1(), this.testhashs64Fnv1(), this.testhashu64Fnv1(), this.testhashs32Fnv1a(), this.testhashu32Fnv1a(), this.testhashs64Fnv1a(), this.testhashu64Fnv1a(), this.bb.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength()), this.testf(), this.testf2(), this.testf3(), this.bb.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length()), this.bb.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength()), this.bb.createScalarList(this.flex.bind(this), this.flexLength()), this.bb.createObjList(this.test5.bind(this), this.test5Length()), this.bb.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength()), this.bb.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength()), (this.parentNamespaceTest() !== null ? this.parentNamespaceTest().unpack() : null), this.bb.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength()), this.singleWeakReference(), this.bb.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength()), this.bb.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength()), this.coOwningReference(), this.bb.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength()), this.nonOwningReference(), this.bb.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()), this.anyUniqueType(), (() => {
-            let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
+            const temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
             if (temp === null) {
                 return null;
             }
             return temp.unpack();
         })(), this.anyAmbiguousType(), (() => {
-            let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
+            const temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
             if (temp === null) {
                 return null;
             }
             return temp.unpack();
-        })(), this.bb.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength()), this.signedEnum(), this.bb.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength()), this.bb.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength()), (this.nativeInline() !== null ? this.nativeInline().unpack() : null), this.longEnumNonEnumDefault(), this.longEnumNormalDefault());
+        })(), this.bb.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength()), this.signedEnum(), this.bb.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength()), this.bb.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength()), (this.nativeInline() !== null ? this.nativeInline().unpack() : null), this.longEnumNonEnumDefault(), this.longEnumNormalDefault(), this.nanDefault(), this.infDefault(), this.positiveInfDefault(), this.infinityDefault(), this.positiveInfinityDefault(), this.negativeInfDefault(), this.negativeInfinityDefault());
     }
     unpackTo(_o) {
         _o.pos = (this.pos() !== null ? this.pos().unpack() : null);
@@ -917,7 +1022,7 @@
         _o.color = this.color();
         _o.testType = this.testType();
         _o.test = (() => {
-            let temp = unionToAny(this.testType(), this.test.bind(this));
+            const temp = unionToAny(this.testType(), this.test.bind(this));
             if (temp === null) {
                 return null;
             }
@@ -959,7 +1064,7 @@
         _o.vectorOfNonOwningReferences = this.bb.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength());
         _o.anyUniqueType = this.anyUniqueType();
         _o.anyUnique = (() => {
-            let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
+            const temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
             if (temp === null) {
                 return null;
             }
@@ -967,7 +1072,7 @@
         })();
         _o.anyAmbiguousType = this.anyAmbiguousType();
         _o.anyAmbiguous = (() => {
-            let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
+            const temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
             if (temp === null) {
                 return null;
             }
@@ -980,10 +1085,17 @@
         _o.nativeInline = (this.nativeInline() !== null ? this.nativeInline().unpack() : null);
         _o.longEnumNonEnumDefault = this.longEnumNonEnumDefault();
         _o.longEnumNormalDefault = this.longEnumNormalDefault();
+        _o.nanDefault = this.nanDefault();
+        _o.infDefault = this.infDefault();
+        _o.positiveInfDefault = this.positiveInfDefault();
+        _o.infinityDefault = this.infinityDefault();
+        _o.positiveInfinityDefault = this.positiveInfinityDefault();
+        _o.negativeInfDefault = this.negativeInfDefault();
+        _o.negativeInfinityDefault = this.negativeInfinityDefault();
     }
 }
 export class MonsterT {
-    constructor(pos = null, mana = 150, hp = 100, name = null, inventory = [], color = Color.Blue, testType = Any.NONE, test = null, test4 = [], testarrayofstring = [], testarrayoftables = [], enemy = null, testnestedflatbuffer = [], testempty = null, testbool = false, testhashs32Fnv1 = 0, testhashu32Fnv1 = 0, testhashs64Fnv1 = BigInt('0'), testhashu64Fnv1 = BigInt('0'), testhashs32Fnv1a = 0, testhashu32Fnv1a = 0, testhashs64Fnv1a = BigInt('0'), testhashu64Fnv1a = BigInt('0'), testarrayofbools = [], testf = 3.14159, testf2 = 3.0, testf3 = 0.0, testarrayofstring2 = [], testarrayofsortedstruct = [], flex = [], test5 = [], vectorOfLongs = [], vectorOfDoubles = [], parentNamespaceTest = null, vectorOfReferrables = [], singleWeakReference = BigInt('0'), vectorOfWeakReferences = [], vectorOfStrongReferrables = [], coOwningReference = BigInt('0'), vectorOfCoOwningReferences = [], nonOwningReference = BigInt('0'), vectorOfNonOwningReferences = [], anyUniqueType = AnyUniqueAliases.NONE, anyUnique = null, anyAmbiguousType = AnyAmbiguousAliases.NONE, anyAmbiguous = null, vectorOfEnums = [], signedEnum = Race.None, testrequirednestedflatbuffer = [], scalarKeySortedTables = [], nativeInline = null, longEnumNonEnumDefault = BigInt('0'), longEnumNormalDefault = BigInt('2')) {
+    constructor(pos = null, mana = 150, hp = 100, name = null, inventory = [], color = Color.Blue, testType = Any.NONE, test = null, test4 = [], testarrayofstring = [], testarrayoftables = [], enemy = null, testnestedflatbuffer = [], testempty = null, testbool = false, testhashs32Fnv1 = 0, testhashu32Fnv1 = 0, testhashs64Fnv1 = BigInt('0'), testhashu64Fnv1 = BigInt('0'), testhashs32Fnv1a = 0, testhashu32Fnv1a = 0, testhashs64Fnv1a = BigInt('0'), testhashu64Fnv1a = BigInt('0'), testarrayofbools = [], testf = 3.14159, testf2 = 3.0, testf3 = 0.0, testarrayofstring2 = [], testarrayofsortedstruct = [], flex = [], test5 = [], vectorOfLongs = [], vectorOfDoubles = [], parentNamespaceTest = null, vectorOfReferrables = [], singleWeakReference = BigInt('0'), vectorOfWeakReferences = [], vectorOfStrongReferrables = [], coOwningReference = BigInt('0'), vectorOfCoOwningReferences = [], nonOwningReference = BigInt('0'), vectorOfNonOwningReferences = [], anyUniqueType = AnyUniqueAliases.NONE, anyUnique = null, anyAmbiguousType = AnyAmbiguousAliases.NONE, anyAmbiguous = null, vectorOfEnums = [], signedEnum = Race.None, testrequirednestedflatbuffer = [], scalarKeySortedTables = [], nativeInline = null, longEnumNonEnumDefault = BigInt('0'), longEnumNormalDefault = BigInt('2'), nanDefault = NaN, infDefault = Infinity, positiveInfDefault = Infinity, infinityDefault = Infinity, positiveInfinityDefault = Infinity, negativeInfDefault = -Infinity, negativeInfinityDefault = -Infinity) {
         this.pos = pos;
         this.mana = mana;
         this.hp = hp;
@@ -1037,6 +1149,13 @@
         this.nativeInline = nativeInline;
         this.longEnumNonEnumDefault = longEnumNonEnumDefault;
         this.longEnumNormalDefault = longEnumNormalDefault;
+        this.nanDefault = nanDefault;
+        this.infDefault = infDefault;
+        this.positiveInfDefault = positiveInfDefault;
+        this.infinityDefault = infinityDefault;
+        this.positiveInfinityDefault = positiveInfinityDefault;
+        this.negativeInfDefault = negativeInfDefault;
+        this.negativeInfinityDefault = negativeInfinityDefault;
     }
     pack(builder) {
         const name = (this.name !== null ? builder.createString(this.name) : 0);
@@ -1120,6 +1239,13 @@
         Monster.addNativeInline(builder, (this.nativeInline !== null ? this.nativeInline.pack(builder) : 0));
         Monster.addLongEnumNonEnumDefault(builder, this.longEnumNonEnumDefault);
         Monster.addLongEnumNormalDefault(builder, this.longEnumNormalDefault);
+        Monster.addNanDefault(builder, this.nanDefault);
+        Monster.addInfDefault(builder, this.infDefault);
+        Monster.addPositiveInfDefault(builder, this.positiveInfDefault);
+        Monster.addInfinityDefault(builder, this.infinityDefault);
+        Monster.addPositiveInfinityDefault(builder, this.positiveInfinityDefault);
+        Monster.addNegativeInfDefault(builder, this.negativeInfDefault);
+        Monster.addNegativeInfinityDefault(builder, this.negativeInfinityDefault);
         return Monster.endMonster(builder);
     }
 }
diff --git a/tests/ts/my-game/example/monster.ts b/tests/ts/my-game/example/monster.ts
index 63e5768..7e205ee 100644
--- a/tests/ts/my-game/example/monster.ts
+++ b/tests/ts/my-game/example/monster.ts
@@ -20,7 +20,7 @@
 /**
  * an example documentation comment: "monster object"
  */
-export class Monster {
+export class Monster implements flatbuffers.IUnpackableObject<MonsterT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Monster {
@@ -683,12 +683,140 @@
   return true;
 }
 
+nanDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 112);
+  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : NaN;
+}
+
+mutate_nan_default(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 112);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeFloat32(this.bb_pos + offset, value);
+  return true;
+}
+
+infDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 114);
+  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : Infinity;
+}
+
+mutate_inf_default(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 114);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeFloat32(this.bb_pos + offset, value);
+  return true;
+}
+
+positiveInfDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 116);
+  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : Infinity;
+}
+
+mutate_positive_inf_default(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 116);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeFloat32(this.bb_pos + offset, value);
+  return true;
+}
+
+infinityDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 118);
+  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : Infinity;
+}
+
+mutate_infinity_default(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 118);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeFloat32(this.bb_pos + offset, value);
+  return true;
+}
+
+positiveInfinityDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 120);
+  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : Infinity;
+}
+
+mutate_positive_infinity_default(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 120);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeFloat32(this.bb_pos + offset, value);
+  return true;
+}
+
+negativeInfDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 122);
+  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : -Infinity;
+}
+
+mutate_negative_inf_default(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 122);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeFloat32(this.bb_pos + offset, value);
+  return true;
+}
+
+negativeInfinityDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 124);
+  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : -Infinity;
+}
+
+mutate_negative_infinity_default(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 124);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeFloat32(this.bb_pos + offset, value);
+  return true;
+}
+
+doubleInfDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 126);
+  return offset ? this.bb!.readFloat64(this.bb_pos + offset) : Infinity;
+}
+
+mutate_double_inf_default(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 126);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeFloat64(this.bb_pos + offset, value);
+  return true;
+}
+
 static getFullyQualifiedName():string {
   return 'MyGame_Example_Monster';
 }
 
 static startMonster(builder:flatbuffers.Builder) {
-  builder.startObject(54);
+  builder.startObject(62);
 }
 
 static addPos(builder:flatbuffers.Builder, posOffset:flatbuffers.Offset) {
@@ -1124,6 +1252,38 @@
   builder.addFieldInt64(53, longEnumNormalDefault, BigInt('2'));
 }
 
+static addNanDefault(builder:flatbuffers.Builder, nanDefault:number) {
+  builder.addFieldFloat32(54, nanDefault, NaN);
+}
+
+static addInfDefault(builder:flatbuffers.Builder, infDefault:number) {
+  builder.addFieldFloat32(55, infDefault, Infinity);
+}
+
+static addPositiveInfDefault(builder:flatbuffers.Builder, positiveInfDefault:number) {
+  builder.addFieldFloat32(56, positiveInfDefault, Infinity);
+}
+
+static addInfinityDefault(builder:flatbuffers.Builder, infinityDefault:number) {
+  builder.addFieldFloat32(57, infinityDefault, Infinity);
+}
+
+static addPositiveInfinityDefault(builder:flatbuffers.Builder, positiveInfinityDefault:number) {
+  builder.addFieldFloat32(58, positiveInfinityDefault, Infinity);
+}
+
+static addNegativeInfDefault(builder:flatbuffers.Builder, negativeInfDefault:number) {
+  builder.addFieldFloat32(59, negativeInfDefault, -Infinity);
+}
+
+static addNegativeInfinityDefault(builder:flatbuffers.Builder, negativeInfinityDefault:number) {
+  builder.addFieldFloat32(60, negativeInfinityDefault, -Infinity);
+}
+
+static addDoubleInfDefault(builder:flatbuffers.Builder, doubleInfDefault:number) {
+  builder.addFieldFloat64(61, doubleInfDefault, Infinity);
+}
+
 static endMonster(builder:flatbuffers.Builder):flatbuffers.Offset {
   const offset = builder.endObject();
   builder.requiredField(offset, 10) // name
@@ -1153,19 +1313,19 @@
     this.mana(),
     this.hp(),
     this.name(),
-    this.bb!.createScalarList(this.inventory.bind(this), this.inventoryLength()),
+    this.bb!.createScalarList<number>(this.inventory.bind(this), this.inventoryLength()),
     this.color(),
     this.testType(),
     (() => {
-      let temp = unionToAny(this.testType(), this.test.bind(this));
+      const temp = unionToAny(this.testType(), this.test.bind(this));
       if(temp === null) { return null; }
       return temp.unpack()
   })(),
-    this.bb!.createObjList(this.test4.bind(this), this.test4Length()),
-    this.bb!.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength()),
-    this.bb!.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength()),
+    this.bb!.createObjList<Test, TestT>(this.test4.bind(this), this.test4Length()),
+    this.bb!.createScalarList<string>(this.testarrayofstring.bind(this), this.testarrayofstringLength()),
+    this.bb!.createObjList<Monster, MonsterT>(this.testarrayoftables.bind(this), this.testarrayoftablesLength()),
     (this.enemy() !== null ? this.enemy()!.unpack() : null),
-    this.bb!.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength()),
+    this.bb!.createScalarList<number>(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength()),
     (this.testempty() !== null ? this.testempty()!.unpack() : null),
     this.testbool(),
     this.testhashs32Fnv1(),
@@ -1176,44 +1336,52 @@
     this.testhashu32Fnv1a(),
     this.testhashs64Fnv1a(),
     this.testhashu64Fnv1a(),
-    this.bb!.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength()),
+    this.bb!.createScalarList<boolean>(this.testarrayofbools.bind(this), this.testarrayofboolsLength()),
     this.testf(),
     this.testf2(),
     this.testf3(),
-    this.bb!.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length()),
-    this.bb!.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength()),
-    this.bb!.createScalarList(this.flex.bind(this), this.flexLength()),
-    this.bb!.createObjList(this.test5.bind(this), this.test5Length()),
-    this.bb!.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength()),
-    this.bb!.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength()),
+    this.bb!.createScalarList<string>(this.testarrayofstring2.bind(this), this.testarrayofstring2Length()),
+    this.bb!.createObjList<Ability, AbilityT>(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength()),
+    this.bb!.createScalarList<number>(this.flex.bind(this), this.flexLength()),
+    this.bb!.createObjList<Test, TestT>(this.test5.bind(this), this.test5Length()),
+    this.bb!.createScalarList<bigint>(this.vectorOfLongs.bind(this), this.vectorOfLongsLength()),
+    this.bb!.createScalarList<number>(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength()),
     (this.parentNamespaceTest() !== null ? this.parentNamespaceTest()!.unpack() : null),
-    this.bb!.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength()),
+    this.bb!.createObjList<Referrable, ReferrableT>(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength()),
     this.singleWeakReference(),
-    this.bb!.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength()),
-    this.bb!.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength()),
+    this.bb!.createScalarList<bigint>(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength()),
+    this.bb!.createObjList<Referrable, ReferrableT>(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength()),
     this.coOwningReference(),
-    this.bb!.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength()),
+    this.bb!.createScalarList<bigint>(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength()),
     this.nonOwningReference(),
-    this.bb!.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()),
+    this.bb!.createScalarList<bigint>(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()),
     this.anyUniqueType(),
     (() => {
-      let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
+      const temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
       if(temp === null) { return null; }
       return temp.unpack()
   })(),
     this.anyAmbiguousType(),
     (() => {
-      let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
+      const temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
       if(temp === null) { return null; }
       return temp.unpack()
   })(),
-    this.bb!.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength()),
+    this.bb!.createScalarList<Color>(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength()),
     this.signedEnum(),
-    this.bb!.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength()),
-    this.bb!.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength()),
+    this.bb!.createScalarList<number>(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength()),
+    this.bb!.createObjList<Stat, StatT>(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength()),
     (this.nativeInline() !== null ? this.nativeInline()!.unpack() : null),
     this.longEnumNonEnumDefault(),
-    this.longEnumNormalDefault()
+    this.longEnumNormalDefault(),
+    this.nanDefault(),
+    this.infDefault(),
+    this.positiveInfDefault(),
+    this.infinityDefault(),
+    this.positiveInfinityDefault(),
+    this.negativeInfDefault(),
+    this.negativeInfinityDefault(),
+    this.doubleInfDefault()
   );
 }
 
@@ -1223,19 +1391,19 @@
   _o.mana = this.mana();
   _o.hp = this.hp();
   _o.name = this.name();
-  _o.inventory = this.bb!.createScalarList(this.inventory.bind(this), this.inventoryLength());
+  _o.inventory = this.bb!.createScalarList<number>(this.inventory.bind(this), this.inventoryLength());
   _o.color = this.color();
   _o.testType = this.testType();
   _o.test = (() => {
-      let temp = unionToAny(this.testType(), this.test.bind(this));
+      const temp = unionToAny(this.testType(), this.test.bind(this));
       if(temp === null) { return null; }
       return temp.unpack()
   })();
-  _o.test4 = this.bb!.createObjList(this.test4.bind(this), this.test4Length());
-  _o.testarrayofstring = this.bb!.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength());
-  _o.testarrayoftables = this.bb!.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength());
+  _o.test4 = this.bb!.createObjList<Test, TestT>(this.test4.bind(this), this.test4Length());
+  _o.testarrayofstring = this.bb!.createScalarList<string>(this.testarrayofstring.bind(this), this.testarrayofstringLength());
+  _o.testarrayoftables = this.bb!.createObjList<Monster, MonsterT>(this.testarrayoftables.bind(this), this.testarrayoftablesLength());
   _o.enemy = (this.enemy() !== null ? this.enemy()!.unpack() : null);
-  _o.testnestedflatbuffer = this.bb!.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength());
+  _o.testnestedflatbuffer = this.bb!.createScalarList<number>(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength());
   _o.testempty = (this.testempty() !== null ? this.testempty()!.unpack() : null);
   _o.testbool = this.testbool();
   _o.testhashs32Fnv1 = this.testhashs32Fnv1();
@@ -1246,48 +1414,56 @@
   _o.testhashu32Fnv1a = this.testhashu32Fnv1a();
   _o.testhashs64Fnv1a = this.testhashs64Fnv1a();
   _o.testhashu64Fnv1a = this.testhashu64Fnv1a();
-  _o.testarrayofbools = this.bb!.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength());
+  _o.testarrayofbools = this.bb!.createScalarList<boolean>(this.testarrayofbools.bind(this), this.testarrayofboolsLength());
   _o.testf = this.testf();
   _o.testf2 = this.testf2();
   _o.testf3 = this.testf3();
-  _o.testarrayofstring2 = this.bb!.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length());
-  _o.testarrayofsortedstruct = this.bb!.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength());
-  _o.flex = this.bb!.createScalarList(this.flex.bind(this), this.flexLength());
-  _o.test5 = this.bb!.createObjList(this.test5.bind(this), this.test5Length());
-  _o.vectorOfLongs = this.bb!.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength());
-  _o.vectorOfDoubles = this.bb!.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength());
+  _o.testarrayofstring2 = this.bb!.createScalarList<string>(this.testarrayofstring2.bind(this), this.testarrayofstring2Length());
+  _o.testarrayofsortedstruct = this.bb!.createObjList<Ability, AbilityT>(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength());
+  _o.flex = this.bb!.createScalarList<number>(this.flex.bind(this), this.flexLength());
+  _o.test5 = this.bb!.createObjList<Test, TestT>(this.test5.bind(this), this.test5Length());
+  _o.vectorOfLongs = this.bb!.createScalarList<bigint>(this.vectorOfLongs.bind(this), this.vectorOfLongsLength());
+  _o.vectorOfDoubles = this.bb!.createScalarList<number>(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength());
   _o.parentNamespaceTest = (this.parentNamespaceTest() !== null ? this.parentNamespaceTest()!.unpack() : null);
-  _o.vectorOfReferrables = this.bb!.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength());
+  _o.vectorOfReferrables = this.bb!.createObjList<Referrable, ReferrableT>(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength());
   _o.singleWeakReference = this.singleWeakReference();
-  _o.vectorOfWeakReferences = this.bb!.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength());
-  _o.vectorOfStrongReferrables = this.bb!.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength());
+  _o.vectorOfWeakReferences = this.bb!.createScalarList<bigint>(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength());
+  _o.vectorOfStrongReferrables = this.bb!.createObjList<Referrable, ReferrableT>(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength());
   _o.coOwningReference = this.coOwningReference();
-  _o.vectorOfCoOwningReferences = this.bb!.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength());
+  _o.vectorOfCoOwningReferences = this.bb!.createScalarList<bigint>(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength());
   _o.nonOwningReference = this.nonOwningReference();
-  _o.vectorOfNonOwningReferences = this.bb!.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength());
+  _o.vectorOfNonOwningReferences = this.bb!.createScalarList<bigint>(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength());
   _o.anyUniqueType = this.anyUniqueType();
   _o.anyUnique = (() => {
-      let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
+      const temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
       if(temp === null) { return null; }
       return temp.unpack()
   })();
   _o.anyAmbiguousType = this.anyAmbiguousType();
   _o.anyAmbiguous = (() => {
-      let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
+      const temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
       if(temp === null) { return null; }
       return temp.unpack()
   })();
-  _o.vectorOfEnums = this.bb!.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength());
+  _o.vectorOfEnums = this.bb!.createScalarList<Color>(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength());
   _o.signedEnum = this.signedEnum();
-  _o.testrequirednestedflatbuffer = this.bb!.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength());
-  _o.scalarKeySortedTables = this.bb!.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength());
+  _o.testrequirednestedflatbuffer = this.bb!.createScalarList<number>(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength());
+  _o.scalarKeySortedTables = this.bb!.createObjList<Stat, StatT>(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength());
   _o.nativeInline = (this.nativeInline() !== null ? this.nativeInline()!.unpack() : null);
   _o.longEnumNonEnumDefault = this.longEnumNonEnumDefault();
   _o.longEnumNormalDefault = this.longEnumNormalDefault();
+  _o.nanDefault = this.nanDefault();
+  _o.infDefault = this.infDefault();
+  _o.positiveInfDefault = this.positiveInfDefault();
+  _o.infinityDefault = this.infinityDefault();
+  _o.positiveInfinityDefault = this.positiveInfinityDefault();
+  _o.negativeInfDefault = this.negativeInfDefault();
+  _o.negativeInfinityDefault = this.negativeInfinityDefault();
+  _o.doubleInfDefault = this.doubleInfDefault();
 }
 }
 
-export class MonsterT {
+export class MonsterT implements flatbuffers.IGeneratedObject {
 constructor(
   public pos: Vec3T|null = null,
   public mana: number = 150,
@@ -1341,7 +1517,15 @@
   public scalarKeySortedTables: (StatT)[] = [],
   public nativeInline: TestT|null = null,
   public longEnumNonEnumDefault: bigint = BigInt('0'),
-  public longEnumNormalDefault: bigint = BigInt('2')
+  public longEnumNormalDefault: bigint = BigInt('2'),
+  public nanDefault: number = NaN,
+  public infDefault: number = Infinity,
+  public positiveInfDefault: number = Infinity,
+  public infinityDefault: number = Infinity,
+  public positiveInfinityDefault: number = Infinity,
+  public negativeInfDefault: number = -Infinity,
+  public negativeInfinityDefault: number = -Infinity,
+  public doubleInfDefault: number = Infinity
 ){}
 
 
@@ -1428,6 +1612,14 @@
   Monster.addNativeInline(builder, (this.nativeInline !== null ? this.nativeInline!.pack(builder) : 0));
   Monster.addLongEnumNonEnumDefault(builder, this.longEnumNonEnumDefault);
   Monster.addLongEnumNormalDefault(builder, this.longEnumNormalDefault);
+  Monster.addNanDefault(builder, this.nanDefault);
+  Monster.addInfDefault(builder, this.infDefault);
+  Monster.addPositiveInfDefault(builder, this.positiveInfDefault);
+  Monster.addInfinityDefault(builder, this.infinityDefault);
+  Monster.addPositiveInfinityDefault(builder, this.positiveInfinityDefault);
+  Monster.addNegativeInfDefault(builder, this.negativeInfDefault);
+  Monster.addNegativeInfinityDefault(builder, this.negativeInfinityDefault);
+  Monster.addDoubleInfDefault(builder, this.doubleInfDefault);
 
   return Monster.endMonster(builder);
 }
diff --git a/tests/ts/my-game/example/referrable.ts b/tests/ts/my-game/example/referrable.ts
index ec02980..5260362 100644
--- a/tests/ts/my-game/example/referrable.ts
+++ b/tests/ts/my-game/example/referrable.ts
@@ -4,7 +4,7 @@
 
 
 
-export class Referrable {
+export class Referrable implements flatbuffers.IUnpackableObject<ReferrableT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Referrable {
@@ -81,7 +81,7 @@
 }
 }
 
-export class ReferrableT {
+export class ReferrableT implements flatbuffers.IGeneratedObject {
 constructor(
   public id: bigint = BigInt('0')
 ){}
diff --git a/tests/ts/my-game/example/stat.ts b/tests/ts/my-game/example/stat.ts
index e452599..c1597b2 100644
--- a/tests/ts/my-game/example/stat.ts
+++ b/tests/ts/my-game/example/stat.ts
@@ -4,7 +4,7 @@
 
 
 
-export class Stat {
+export class Stat implements flatbuffers.IUnpackableObject<StatT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Stat {
@@ -118,7 +118,7 @@
 }
 }
 
-export class StatT {
+export class StatT implements flatbuffers.IGeneratedObject {
 constructor(
   public id: string|Uint8Array|null = null,
   public val: bigint = BigInt('0'),
diff --git a/tests/ts/my-game/example/struct-of-structs-of-structs.ts b/tests/ts/my-game/example/struct-of-structs-of-structs.ts
index 52efc12..fa17939 100644
--- a/tests/ts/my-game/example/struct-of-structs-of-structs.ts
+++ b/tests/ts/my-game/example/struct-of-structs-of-structs.ts
@@ -5,7 +5,7 @@
 import { StructOfStructs, StructOfStructsT } from '../../my-game/example/struct-of-structs.js';
 
 
-export class StructOfStructsOfStructs {
+export class StructOfStructsOfStructs implements flatbuffers.IUnpackableObject<StructOfStructsOfStructsT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructsOfStructs {
@@ -55,7 +55,7 @@
 }
 }
 
-export class StructOfStructsOfStructsT {
+export class StructOfStructsOfStructsT implements flatbuffers.IGeneratedObject {
 constructor(
   public a: StructOfStructsT|null = null
 ){}
diff --git a/tests/ts/my-game/example/struct-of-structs.ts b/tests/ts/my-game/example/struct-of-structs.ts
index 749a73c..10d3607 100644
--- a/tests/ts/my-game/example/struct-of-structs.ts
+++ b/tests/ts/my-game/example/struct-of-structs.ts
@@ -6,7 +6,7 @@
 import { Test, TestT } from '../../my-game/example/test.js';
 
 
-export class StructOfStructs {
+export class StructOfStructs implements flatbuffers.IUnpackableObject<StructOfStructsT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructs {
@@ -67,7 +67,7 @@
 }
 }
 
-export class StructOfStructsT {
+export class StructOfStructsT implements flatbuffers.IGeneratedObject {
 constructor(
   public a: AbilityT|null = null,
   public b: TestT|null = null,
diff --git a/tests/ts/my-game/example/test-simple-table-with-enum.ts b/tests/ts/my-game/example/test-simple-table-with-enum.ts
index cfca00b..903ab99 100644
--- a/tests/ts/my-game/example/test-simple-table-with-enum.ts
+++ b/tests/ts/my-game/example/test-simple-table-with-enum.ts
@@ -5,7 +5,7 @@
 import { Color } from '../../my-game/example/color.js';
 
 
-export class TestSimpleTableWithEnum {
+export class TestSimpleTableWithEnum implements flatbuffers.IUnpackableObject<TestSimpleTableWithEnumT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):TestSimpleTableWithEnum {
@@ -82,7 +82,7 @@
 }
 }
 
-export class TestSimpleTableWithEnumT {
+export class TestSimpleTableWithEnumT implements flatbuffers.IGeneratedObject {
 constructor(
   public color: Color = Color.Green
 ){}
diff --git a/tests/ts/my-game/example/test.ts b/tests/ts/my-game/example/test.ts
index b3d84ee..7484f2c 100644
--- a/tests/ts/my-game/example/test.ts
+++ b/tests/ts/my-game/example/test.ts
@@ -4,7 +4,7 @@
 
 
 
-export class Test {
+export class Test implements flatbuffers.IUnpackableObject<TestT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Test {
@@ -62,7 +62,7 @@
 }
 }
 
-export class TestT {
+export class TestT implements flatbuffers.IGeneratedObject {
 constructor(
   public a: number = 0,
   public b: number = 0
diff --git a/tests/ts/my-game/example/type-aliases.ts b/tests/ts/my-game/example/type-aliases.ts
index 805c8cf..93262d7 100644
--- a/tests/ts/my-game/example/type-aliases.ts
+++ b/tests/ts/my-game/example/type-aliases.ts
@@ -4,7 +4,7 @@
 
 
 
-export class TypeAliases {
+export class TypeAliases implements flatbuffers.IUnpackableObject<TypeAliasesT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):TypeAliases {
@@ -344,8 +344,8 @@
     this.u64(),
     this.f32(),
     this.f64(),
-    this.bb!.createScalarList(this.v8.bind(this), this.v8Length()),
-    this.bb!.createScalarList(this.vf64.bind(this), this.vf64Length())
+    this.bb!.createScalarList<number>(this.v8.bind(this), this.v8Length()),
+    this.bb!.createScalarList<number>(this.vf64.bind(this), this.vf64Length())
   );
 }
 
@@ -361,12 +361,12 @@
   _o.u64 = this.u64();
   _o.f32 = this.f32();
   _o.f64 = this.f64();
-  _o.v8 = this.bb!.createScalarList(this.v8.bind(this), this.v8Length());
-  _o.vf64 = this.bb!.createScalarList(this.vf64.bind(this), this.vf64Length());
+  _o.v8 = this.bb!.createScalarList<number>(this.v8.bind(this), this.v8Length());
+  _o.vf64 = this.bb!.createScalarList<number>(this.vf64.bind(this), this.vf64Length());
 }
 }
 
-export class TypeAliasesT {
+export class TypeAliasesT implements flatbuffers.IGeneratedObject {
 constructor(
   public i8: number = 0,
   public u8: number = 0,
diff --git a/tests/ts/my-game/example/vec3.ts b/tests/ts/my-game/example/vec3.ts
index bc4c473..84516e0 100644
--- a/tests/ts/my-game/example/vec3.ts
+++ b/tests/ts/my-game/example/vec3.ts
@@ -6,7 +6,7 @@
 import { Test, TestT } from '../../my-game/example/test.js';
 
 
-export class Vec3 {
+export class Vec3 implements flatbuffers.IUnpackableObject<Vec3T> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Vec3 {
@@ -112,7 +112,7 @@
 }
 }
 
-export class Vec3T {
+export class Vec3T implements flatbuffers.IGeneratedObject {
 constructor(
   public x: number = 0.0,
   public y: number = 0.0,
diff --git a/tests/ts/my-game/example2/monster.ts b/tests/ts/my-game/example2/monster.ts
index 7240476..0714486 100644
--- a/tests/ts/my-game/example2/monster.ts
+++ b/tests/ts/my-game/example2/monster.ts
@@ -4,7 +4,7 @@
 
 
 
-export class Monster {
+export class Monster implements flatbuffers.IUnpackableObject<MonsterT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Monster {
@@ -56,7 +56,7 @@
 unpackTo(_o: MonsterT): void {}
 }
 
-export class MonsterT {
+export class MonsterT implements flatbuffers.IGeneratedObject {
 constructor(){}
 
 
diff --git a/tests/ts/my-game/in-parent-namespace.ts b/tests/ts/my-game/in-parent-namespace.ts
index 0de94df..0e2f412 100644
--- a/tests/ts/my-game/in-parent-namespace.ts
+++ b/tests/ts/my-game/in-parent-namespace.ts
@@ -4,7 +4,7 @@
 
 
 
-export class InParentNamespace {
+export class InParentNamespace implements flatbuffers.IUnpackableObject<InParentNamespaceT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):InParentNamespace {
@@ -56,7 +56,7 @@
 unpackTo(_o: InParentNamespaceT): void {}
 }
 
-export class InParentNamespaceT {
+export class InParentNamespaceT implements flatbuffers.IGeneratedObject {
 constructor(){}
 
 
diff --git a/tests/ts/reflection/enum-val.js b/tests/ts/reflection/enum-val.js
index f2ce03d..93926a6 100644
--- a/tests/ts/reflection/enum-val.js
+++ b/tests/ts/reflection/enum-val.js
@@ -1,5 +1,6 @@
 // automatically generated by the FlatBuffers compiler, do not modify
 import * as flatbuffers from 'flatbuffers';
+import { KeyValue } from '../reflection/key-value.js';
 import { Type } from '../reflection/type.js';
 export class EnumVal {
     constructor() {
@@ -46,11 +47,19 @@
         const offset = this.bb.__offset(this.bb_pos, 12);
         return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
     }
+    attributes(index, obj) {
+        const offset = this.bb.__offset(this.bb_pos, 14);
+        return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+    }
+    attributesLength() {
+        const offset = this.bb.__offset(this.bb_pos, 14);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
     static getFullyQualifiedName() {
         return 'reflection_EnumVal';
     }
     static startEnumVal(builder) {
-        builder.startObject(5);
+        builder.startObject(6);
     }
     static addName(builder, nameOffset) {
         builder.addFieldOffset(0, nameOffset, 0);
@@ -74,37 +83,54 @@
     static startDocumentationVector(builder, numElems) {
         builder.startVector(4, numElems, 4);
     }
+    static addAttributes(builder, attributesOffset) {
+        builder.addFieldOffset(5, attributesOffset, 0);
+    }
+    static createAttributesVector(builder, data) {
+        builder.startVector(4, data.length, 4);
+        for (let i = data.length - 1; i >= 0; i--) {
+            builder.addOffset(data[i]);
+        }
+        return builder.endVector();
+    }
+    static startAttributesVector(builder, numElems) {
+        builder.startVector(4, numElems, 4);
+    }
     static endEnumVal(builder) {
         const offset = builder.endObject();
         builder.requiredField(offset, 4); // name
         return offset;
     }
     unpack() {
-        return new EnumValT(this.name(), this.value(), (this.unionType() !== null ? this.unionType().unpack() : null), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()));
+        return new EnumValT(this.name(), this.value(), (this.unionType() !== null ? this.unionType().unpack() : null), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()));
     }
     unpackTo(_o) {
         _o.name = this.name();
         _o.value = this.value();
         _o.unionType = (this.unionType() !== null ? this.unionType().unpack() : null);
         _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
+        _o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
     }
 }
 export class EnumValT {
-    constructor(name = null, value = BigInt('0'), unionType = null, documentation = []) {
+    constructor(name = null, value = BigInt('0'), unionType = null, documentation = [], attributes = []) {
         this.name = name;
         this.value = value;
         this.unionType = unionType;
         this.documentation = documentation;
+        this.attributes = attributes;
     }
     pack(builder) {
         const name = (this.name !== null ? builder.createString(this.name) : 0);
         const unionType = (this.unionType !== null ? this.unionType.pack(builder) : 0);
         const documentation = EnumVal.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+        const attributes = EnumVal.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
         EnumVal.startEnumVal(builder);
         EnumVal.addName(builder, name);
         EnumVal.addValue(builder, this.value);
         EnumVal.addUnionType(builder, unionType);
         EnumVal.addDocumentation(builder, documentation);
+        EnumVal.addAttributes(builder, attributes);
         return EnumVal.endEnumVal(builder);
     }
 }
diff --git a/tests/ts/reflection/enum-val.ts b/tests/ts/reflection/enum-val.ts
index 8527832..3119a20 100644
--- a/tests/ts/reflection/enum-val.ts
+++ b/tests/ts/reflection/enum-val.ts
@@ -2,10 +2,11 @@
 
 import * as flatbuffers from 'flatbuffers';
 
+import { KeyValue, KeyValueT } from '../reflection/key-value.js';
 import { Type, TypeT } from '../reflection/type.js';
 
 
-export class EnumVal {
+export class EnumVal implements flatbuffers.IUnpackableObject<EnumValT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):EnumVal {
@@ -63,12 +64,22 @@
   return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
 }
 
+attributes(index: number, obj?:KeyValue):KeyValue|null {
+  const offset = this.bb!.__offset(this.bb_pos, 14);
+  return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+attributesLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 14);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
 static getFullyQualifiedName():string {
   return 'reflection_EnumVal';
 }
 
 static startEnumVal(builder:flatbuffers.Builder) {
-  builder.startObject(5);
+  builder.startObject(6);
 }
 
 static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
@@ -99,6 +110,22 @@
   builder.startVector(4, numElems, 4);
 }
 
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(5, attributesOffset, 0);
+}
+
+static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+  builder.startVector(4, data.length, 4);
+  for (let i = data.length - 1; i >= 0; i--) {
+    builder.addOffset(data[i]!);
+  }
+  return builder.endVector();
+}
+
+static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
+  builder.startVector(4, numElems, 4);
+}
+
 static endEnumVal(builder:flatbuffers.Builder):flatbuffers.Offset {
   const offset = builder.endObject();
   builder.requiredField(offset, 4) // name
@@ -111,7 +138,8 @@
     this.name(),
     this.value(),
     (this.unionType() !== null ? this.unionType()!.unpack() : null),
-    this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength())
+    this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()),
+    this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength())
   );
 }
 
@@ -120,16 +148,18 @@
   _o.name = this.name();
   _o.value = this.value();
   _o.unionType = (this.unionType() !== null ? this.unionType()!.unpack() : null);
-  _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+  _o.documentation = this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength());
+  _o.attributes = this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength());
 }
 }
 
-export class EnumValT {
+export class EnumValT implements flatbuffers.IGeneratedObject {
 constructor(
   public name: string|Uint8Array|null = null,
   public value: bigint = BigInt('0'),
   public unionType: TypeT|null = null,
-  public documentation: (string)[] = []
+  public documentation: (string)[] = [],
+  public attributes: (KeyValueT)[] = []
 ){}
 
 
@@ -137,12 +167,14 @@
   const name = (this.name !== null ? builder.createString(this.name!) : 0);
   const unionType = (this.unionType !== null ? this.unionType!.pack(builder) : 0);
   const documentation = EnumVal.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+  const attributes = EnumVal.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
 
   EnumVal.startEnumVal(builder);
   EnumVal.addName(builder, name);
   EnumVal.addValue(builder, this.value);
   EnumVal.addUnionType(builder, unionType);
   EnumVal.addDocumentation(builder, documentation);
+  EnumVal.addAttributes(builder, attributes);
 
   return EnumVal.endEnumVal(builder);
 }
diff --git a/tests/ts/reflection/enum.ts b/tests/ts/reflection/enum.ts
index 7bba354..34d1377 100644
--- a/tests/ts/reflection/enum.ts
+++ b/tests/ts/reflection/enum.ts
@@ -7,7 +7,7 @@
 import { Type, TypeT } from '../reflection/type.js';
 
 
-export class Enum {
+export class Enum implements flatbuffers.IUnpackableObject<EnumT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Enum {
@@ -179,11 +179,11 @@
 unpack(): EnumT {
   return new EnumT(
     this.name(),
-    this.bb!.createObjList(this.values.bind(this), this.valuesLength()),
+    this.bb!.createObjList<EnumVal, EnumValT>(this.values.bind(this), this.valuesLength()),
     this.isUnion(),
     (this.underlyingType() !== null ? this.underlyingType()!.unpack() : null),
-    this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
-    this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+    this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()),
+    this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()),
     this.declarationFile()
   );
 }
@@ -191,16 +191,16 @@
 
 unpackTo(_o: EnumT): void {
   _o.name = this.name();
-  _o.values = this.bb!.createObjList(this.values.bind(this), this.valuesLength());
+  _o.values = this.bb!.createObjList<EnumVal, EnumValT>(this.values.bind(this), this.valuesLength());
   _o.isUnion = this.isUnion();
   _o.underlyingType = (this.underlyingType() !== null ? this.underlyingType()!.unpack() : null);
-  _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
-  _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+  _o.attributes = this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength());
+  _o.documentation = this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength());
   _o.declarationFile = this.declarationFile();
 }
 }
 
-export class EnumT {
+export class EnumT implements flatbuffers.IGeneratedObject {
 constructor(
   public name: string|Uint8Array|null = null,
   public values: (EnumValT)[] = [],
diff --git a/tests/ts/reflection/field.ts b/tests/ts/reflection/field.ts
index 48c1bed..9734fba 100644
--- a/tests/ts/reflection/field.ts
+++ b/tests/ts/reflection/field.ts
@@ -6,7 +6,7 @@
 import { Type, TypeT } from '../reflection/type.js';
 
 
-export class Field {
+export class Field implements flatbuffers.IUnpackableObject<FieldT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Field {
@@ -308,8 +308,8 @@
     this.deprecated(),
     this.required(),
     this.key(),
-    this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
-    this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+    this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()),
+    this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()),
     this.optional(),
     this.padding()
   );
@@ -326,14 +326,14 @@
   _o.deprecated = this.deprecated();
   _o.required = this.required();
   _o.key = this.key();
-  _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
-  _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+  _o.attributes = this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength());
+  _o.documentation = this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength());
   _o.optional = this.optional();
   _o.padding = this.padding();
 }
 }
 
-export class FieldT {
+export class FieldT implements flatbuffers.IGeneratedObject {
 constructor(
   public name: string|Uint8Array|null = null,
   public type: TypeT|null = null,
diff --git a/tests/ts/reflection/key-value.ts b/tests/ts/reflection/key-value.ts
index 736766b..93262f4 100644
--- a/tests/ts/reflection/key-value.ts
+++ b/tests/ts/reflection/key-value.ts
@@ -4,7 +4,7 @@
 
 
 
-export class KeyValue {
+export class KeyValue implements flatbuffers.IUnpackableObject<KeyValueT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):KeyValue {
@@ -79,7 +79,7 @@
 }
 }
 
-export class KeyValueT {
+export class KeyValueT implements flatbuffers.IGeneratedObject {
 constructor(
   public key: string|Uint8Array|null = null,
   public value: string|Uint8Array|null = null
diff --git a/tests/ts/reflection/object.ts b/tests/ts/reflection/object.ts
index 1e14f03..fbe7006 100644
--- a/tests/ts/reflection/object.ts
+++ b/tests/ts/reflection/object.ts
@@ -6,7 +6,7 @@
 import { KeyValue, KeyValueT } from '../reflection/key-value.js';
 
 
-export class Object_ {
+export class Object_ implements flatbuffers.IUnpackableObject<Object_T> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Object_ {
@@ -220,12 +220,12 @@
 unpack(): Object_T {
   return new Object_T(
     this.name(),
-    this.bb!.createObjList(this.fields.bind(this), this.fieldsLength()),
+    this.bb!.createObjList<Field, FieldT>(this.fields.bind(this), this.fieldsLength()),
     this.isStruct(),
     this.minalign(),
     this.bytesize(),
-    this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
-    this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+    this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()),
+    this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()),
     this.declarationFile()
   );
 }
@@ -233,17 +233,17 @@
 
 unpackTo(_o: Object_T): void {
   _o.name = this.name();
-  _o.fields = this.bb!.createObjList(this.fields.bind(this), this.fieldsLength());
+  _o.fields = this.bb!.createObjList<Field, FieldT>(this.fields.bind(this), this.fieldsLength());
   _o.isStruct = this.isStruct();
   _o.minalign = this.minalign();
   _o.bytesize = this.bytesize();
-  _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
-  _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+  _o.attributes = this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength());
+  _o.documentation = this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength());
   _o.declarationFile = this.declarationFile();
 }
 }
 
-export class Object_T {
+export class Object_T implements flatbuffers.IGeneratedObject {
 constructor(
   public name: string|Uint8Array|null = null,
   public fields: (FieldT)[] = [],
diff --git a/tests/ts/reflection/rpccall.ts b/tests/ts/reflection/rpccall.ts
index 151d7b1..320de51 100644
--- a/tests/ts/reflection/rpccall.ts
+++ b/tests/ts/reflection/rpccall.ts
@@ -6,7 +6,7 @@
 import { Object_, Object_T } from '../reflection/object.js';
 
 
-export class RPCCall {
+export class RPCCall implements flatbuffers.IUnpackableObject<RPCCallT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):RPCCall {
@@ -129,8 +129,8 @@
     this.name(),
     (this.request() !== null ? this.request()!.unpack() : null),
     (this.response() !== null ? this.response()!.unpack() : null),
-    this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
-    this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength())
+    this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()),
+    this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength())
   );
 }
 
@@ -139,12 +139,12 @@
   _o.name = this.name();
   _o.request = (this.request() !== null ? this.request()!.unpack() : null);
   _o.response = (this.response() !== null ? this.response()!.unpack() : null);
-  _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
-  _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+  _o.attributes = this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength());
+  _o.documentation = this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength());
 }
 }
 
-export class RPCCallT {
+export class RPCCallT implements flatbuffers.IGeneratedObject {
 constructor(
   public name: string|Uint8Array|null = null,
   public request: Object_T|null = null,
diff --git a/tests/ts/reflection/schema-file.ts b/tests/ts/reflection/schema-file.ts
index e1f5035..eda23de 100644
--- a/tests/ts/reflection/schema-file.ts
+++ b/tests/ts/reflection/schema-file.ts
@@ -9,7 +9,7 @@
  * Symbols declared within a file may be recovered by iterating over all
  * symbols and examining the `declaration_file` field.
  */
-export class SchemaFile {
+export class SchemaFile implements flatbuffers.IUnpackableObject<SchemaFileT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):SchemaFile {
@@ -96,18 +96,18 @@
 unpack(): SchemaFileT {
   return new SchemaFileT(
     this.filename(),
-    this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength())
+    this.bb!.createScalarList<string>(this.includedFilenames.bind(this), this.includedFilenamesLength())
   );
 }
 
 
 unpackTo(_o: SchemaFileT): void {
   _o.filename = this.filename();
-  _o.includedFilenames = this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength());
+  _o.includedFilenames = this.bb!.createScalarList<string>(this.includedFilenames.bind(this), this.includedFilenamesLength());
 }
 }
 
-export class SchemaFileT {
+export class SchemaFileT implements flatbuffers.IGeneratedObject {
 constructor(
   public filename: string|Uint8Array|null = null,
   public includedFilenames: (string)[] = []
diff --git a/tests/ts/reflection/schema.ts b/tests/ts/reflection/schema.ts
index d1839c7..c996522 100644
--- a/tests/ts/reflection/schema.ts
+++ b/tests/ts/reflection/schema.ts
@@ -8,7 +8,7 @@
 import { Service, ServiceT } from '../reflection/service.js';
 
 
-export class Schema {
+export class Schema implements flatbuffers.IUnpackableObject<SchemaT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Schema {
@@ -215,31 +215,31 @@
 
 unpack(): SchemaT {
   return new SchemaT(
-    this.bb!.createObjList(this.objects.bind(this), this.objectsLength()),
-    this.bb!.createObjList(this.enums.bind(this), this.enumsLength()),
+    this.bb!.createObjList<Object_, Object_T>(this.objects.bind(this), this.objectsLength()),
+    this.bb!.createObjList<Enum, EnumT>(this.enums.bind(this), this.enumsLength()),
     this.fileIdent(),
     this.fileExt(),
     (this.rootTable() !== null ? this.rootTable()!.unpack() : null),
-    this.bb!.createObjList(this.services.bind(this), this.servicesLength()),
+    this.bb!.createObjList<Service, ServiceT>(this.services.bind(this), this.servicesLength()),
     this.advancedFeatures(),
-    this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength())
+    this.bb!.createObjList<SchemaFile, SchemaFileT>(this.fbsFiles.bind(this), this.fbsFilesLength())
   );
 }
 
 
 unpackTo(_o: SchemaT): void {
-  _o.objects = this.bb!.createObjList(this.objects.bind(this), this.objectsLength());
-  _o.enums = this.bb!.createObjList(this.enums.bind(this), this.enumsLength());
+  _o.objects = this.bb!.createObjList<Object_, Object_T>(this.objects.bind(this), this.objectsLength());
+  _o.enums = this.bb!.createObjList<Enum, EnumT>(this.enums.bind(this), this.enumsLength());
   _o.fileIdent = this.fileIdent();
   _o.fileExt = this.fileExt();
   _o.rootTable = (this.rootTable() !== null ? this.rootTable()!.unpack() : null);
-  _o.services = this.bb!.createObjList(this.services.bind(this), this.servicesLength());
+  _o.services = this.bb!.createObjList<Service, ServiceT>(this.services.bind(this), this.servicesLength());
   _o.advancedFeatures = this.advancedFeatures();
-  _o.fbsFiles = this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength());
+  _o.fbsFiles = this.bb!.createObjList<SchemaFile, SchemaFileT>(this.fbsFiles.bind(this), this.fbsFilesLength());
 }
 }
 
-export class SchemaT {
+export class SchemaT implements flatbuffers.IGeneratedObject {
 constructor(
   public objects: (Object_T)[] = [],
   public enums: (EnumT)[] = [],
diff --git a/tests/ts/reflection/service.ts b/tests/ts/reflection/service.ts
index c083cae..c0ad8ad 100644
--- a/tests/ts/reflection/service.ts
+++ b/tests/ts/reflection/service.ts
@@ -6,7 +6,7 @@
 import { RPCCall, RPCCallT } from '../reflection/rpccall.js';
 
 
-export class Service {
+export class Service implements flatbuffers.IUnpackableObject<ServiceT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Service {
@@ -156,9 +156,9 @@
 unpack(): ServiceT {
   return new ServiceT(
     this.name(),
-    this.bb!.createObjList(this.calls.bind(this), this.callsLength()),
-    this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
-    this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+    this.bb!.createObjList<RPCCall, RPCCallT>(this.calls.bind(this), this.callsLength()),
+    this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()),
+    this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()),
     this.declarationFile()
   );
 }
@@ -166,14 +166,14 @@
 
 unpackTo(_o: ServiceT): void {
   _o.name = this.name();
-  _o.calls = this.bb!.createObjList(this.calls.bind(this), this.callsLength());
-  _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
-  _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+  _o.calls = this.bb!.createObjList<RPCCall, RPCCallT>(this.calls.bind(this), this.callsLength());
+  _o.attributes = this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength());
+  _o.documentation = this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength());
   _o.declarationFile = this.declarationFile();
 }
 }
 
-export class ServiceT {
+export class ServiceT implements flatbuffers.IGeneratedObject {
 constructor(
   public name: string|Uint8Array|null = null,
   public calls: (RPCCallT)[] = [],
diff --git a/tests/ts/reflection/type.ts b/tests/ts/reflection/type.ts
index e831e21..3731695 100644
--- a/tests/ts/reflection/type.ts
+++ b/tests/ts/reflection/type.ts
@@ -5,7 +5,7 @@
 import { BaseType } from '../reflection/base-type.js';
 
 
-export class Type {
+export class Type implements flatbuffers.IUnpackableObject<TypeT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Type {
@@ -195,7 +195,7 @@
 }
 }
 
-export class TypeT {
+export class TypeT implements flatbuffers.IGeneratedObject {
 constructor(
   public baseType: BaseType = BaseType.None,
   public element: BaseType = BaseType.None,
diff --git a/tests/ts/reflection_generated.js b/tests/ts/reflection_generated.js
index dd686cc..e0ed007 100644
--- a/tests/ts/reflection_generated.js
+++ b/tests/ts/reflection_generated.js
@@ -302,11 +302,19 @@
         const offset = this.bb.__offset(this.bb_pos, 12);
         return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
     }
+    attributes(index, obj) {
+        const offset = this.bb.__offset(this.bb_pos, 14);
+        return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+    }
+    attributesLength() {
+        const offset = this.bb.__offset(this.bb_pos, 14);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
     static getFullyQualifiedName() {
         return 'reflection_EnumVal';
     }
     static startEnumVal(builder) {
-        builder.startObject(5);
+        builder.startObject(6);
     }
     static addName(builder, nameOffset) {
         builder.addFieldOffset(0, nameOffset, 0);
@@ -330,37 +338,54 @@
     static startDocumentationVector(builder, numElems) {
         builder.startVector(4, numElems, 4);
     }
+    static addAttributes(builder, attributesOffset) {
+        builder.addFieldOffset(5, attributesOffset, 0);
+    }
+    static createAttributesVector(builder, data) {
+        builder.startVector(4, data.length, 4);
+        for (let i = data.length - 1; i >= 0; i--) {
+            builder.addOffset(data[i]);
+        }
+        return builder.endVector();
+    }
+    static startAttributesVector(builder, numElems) {
+        builder.startVector(4, numElems, 4);
+    }
     static endEnumVal(builder) {
         const offset = builder.endObject();
         builder.requiredField(offset, 4); // name
         return offset;
     }
     unpack() {
-        return new EnumValT(this.name(), this.value(), (this.unionType() !== null ? this.unionType().unpack() : null), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()));
+        return new EnumValT(this.name(), this.value(), (this.unionType() !== null ? this.unionType().unpack() : null), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()));
     }
     unpackTo(_o) {
         _o.name = this.name();
         _o.value = this.value();
         _o.unionType = (this.unionType() !== null ? this.unionType().unpack() : null);
         _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
+        _o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
     }
 }
 export class EnumValT {
-    constructor(name = null, value = BigInt('0'), unionType = null, documentation = []) {
+    constructor(name = null, value = BigInt('0'), unionType = null, documentation = [], attributes = []) {
         this.name = name;
         this.value = value;
         this.unionType = unionType;
         this.documentation = documentation;
+        this.attributes = attributes;
     }
     pack(builder) {
         const name = (this.name !== null ? builder.createString(this.name) : 0);
         const unionType = (this.unionType !== null ? this.unionType.pack(builder) : 0);
         const documentation = EnumVal.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+        const attributes = EnumVal.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
         EnumVal.startEnumVal(builder);
         EnumVal.addName(builder, name);
         EnumVal.addValue(builder, this.value);
         EnumVal.addUnionType(builder, unionType);
         EnumVal.addDocumentation(builder, documentation);
+        EnumVal.addAttributes(builder, attributes);
         return EnumVal.endEnumVal(builder);
     }
 }
diff --git a/tests/ts/reflection_generated.ts b/tests/ts/reflection_generated.ts
index 4bb1222..6b553b1 100644
--- a/tests/ts/reflection_generated.ts
+++ b/tests/ts/reflection_generated.ts
@@ -35,7 +35,7 @@
   DefaultVectorsAndStrings = '8'
 }
 
-export class Type {
+export class Type implements flatbuffers.IUnpackableObject<TypeT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Type {
@@ -225,7 +225,7 @@
 }
 }
 
-export class TypeT {
+export class TypeT implements flatbuffers.IGeneratedObject {
 constructor(
   public baseType: BaseType = BaseType.None,
   public element: BaseType = BaseType.None,
@@ -248,7 +248,7 @@
 }
 }
 
-export class KeyValue {
+export class KeyValue implements flatbuffers.IUnpackableObject<KeyValueT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):KeyValue {
@@ -323,7 +323,7 @@
 }
 }
 
-export class KeyValueT {
+export class KeyValueT implements flatbuffers.IGeneratedObject {
 constructor(
   public key: string|Uint8Array|null = null,
   public value: string|Uint8Array|null = null
@@ -341,7 +341,7 @@
 }
 }
 
-export class EnumVal {
+export class EnumVal implements flatbuffers.IUnpackableObject<EnumValT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):EnumVal {
@@ -399,12 +399,22 @@
   return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
 }
 
+attributes(index: number, obj?:KeyValue):KeyValue|null {
+  const offset = this.bb!.__offset(this.bb_pos, 14);
+  return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+attributesLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 14);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
 static getFullyQualifiedName():string {
   return 'reflection_EnumVal';
 }
 
 static startEnumVal(builder:flatbuffers.Builder) {
-  builder.startObject(5);
+  builder.startObject(6);
 }
 
 static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
@@ -435,6 +445,22 @@
   builder.startVector(4, numElems, 4);
 }
 
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(5, attributesOffset, 0);
+}
+
+static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+  builder.startVector(4, data.length, 4);
+  for (let i = data.length - 1; i >= 0; i--) {
+    builder.addOffset(data[i]!);
+  }
+  return builder.endVector();
+}
+
+static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
+  builder.startVector(4, numElems, 4);
+}
+
 static endEnumVal(builder:flatbuffers.Builder):flatbuffers.Offset {
   const offset = builder.endObject();
   builder.requiredField(offset, 4) // name
@@ -447,7 +473,8 @@
     this.name(),
     this.value(),
     (this.unionType() !== null ? this.unionType()!.unpack() : null),
-    this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength())
+    this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()),
+    this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength())
   );
 }
 
@@ -456,16 +483,18 @@
   _o.name = this.name();
   _o.value = this.value();
   _o.unionType = (this.unionType() !== null ? this.unionType()!.unpack() : null);
-  _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+  _o.documentation = this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength());
+  _o.attributes = this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength());
 }
 }
 
-export class EnumValT {
+export class EnumValT implements flatbuffers.IGeneratedObject {
 constructor(
   public name: string|Uint8Array|null = null,
   public value: bigint = BigInt('0'),
   public unionType: TypeT|null = null,
-  public documentation: (string)[] = []
+  public documentation: (string)[] = [],
+  public attributes: (KeyValueT)[] = []
 ){}
 
 
@@ -473,18 +502,20 @@
   const name = (this.name !== null ? builder.createString(this.name!) : 0);
   const unionType = (this.unionType !== null ? this.unionType!.pack(builder) : 0);
   const documentation = EnumVal.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+  const attributes = EnumVal.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
 
   EnumVal.startEnumVal(builder);
   EnumVal.addName(builder, name);
   EnumVal.addValue(builder, this.value);
   EnumVal.addUnionType(builder, unionType);
   EnumVal.addDocumentation(builder, documentation);
+  EnumVal.addAttributes(builder, attributes);
 
   return EnumVal.endEnumVal(builder);
 }
 }
 
-export class Enum {
+export class Enum implements flatbuffers.IUnpackableObject<EnumT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Enum {
@@ -656,11 +687,11 @@
 unpack(): EnumT {
   return new EnumT(
     this.name(),
-    this.bb!.createObjList(this.values.bind(this), this.valuesLength()),
+    this.bb!.createObjList<EnumVal, EnumValT>(this.values.bind(this), this.valuesLength()),
     this.isUnion(),
     (this.underlyingType() !== null ? this.underlyingType()!.unpack() : null),
-    this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
-    this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+    this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()),
+    this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()),
     this.declarationFile()
   );
 }
@@ -668,16 +699,16 @@
 
 unpackTo(_o: EnumT): void {
   _o.name = this.name();
-  _o.values = this.bb!.createObjList(this.values.bind(this), this.valuesLength());
+  _o.values = this.bb!.createObjList<EnumVal, EnumValT>(this.values.bind(this), this.valuesLength());
   _o.isUnion = this.isUnion();
   _o.underlyingType = (this.underlyingType() !== null ? this.underlyingType()!.unpack() : null);
-  _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
-  _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+  _o.attributes = this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength());
+  _o.documentation = this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength());
   _o.declarationFile = this.declarationFile();
 }
 }
 
-export class EnumT {
+export class EnumT implements flatbuffers.IGeneratedObject {
 constructor(
   public name: string|Uint8Array|null = null,
   public values: (EnumValT)[] = [],
@@ -710,7 +741,7 @@
 }
 }
 
-export class Field {
+export class Field implements flatbuffers.IUnpackableObject<FieldT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Field {
@@ -1012,8 +1043,8 @@
     this.deprecated(),
     this.required(),
     this.key(),
-    this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
-    this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+    this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()),
+    this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()),
     this.optional(),
     this.padding()
   );
@@ -1030,14 +1061,14 @@
   _o.deprecated = this.deprecated();
   _o.required = this.required();
   _o.key = this.key();
-  _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
-  _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+  _o.attributes = this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength());
+  _o.documentation = this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength());
   _o.optional = this.optional();
   _o.padding = this.padding();
 }
 }
 
-export class FieldT {
+export class FieldT implements flatbuffers.IGeneratedObject {
 constructor(
   public name: string|Uint8Array|null = null,
   public type: TypeT|null = null,
@@ -1080,7 +1111,7 @@
 }
 }
 
-export class Object_ {
+export class Object_ implements flatbuffers.IUnpackableObject<Object_T> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Object_ {
@@ -1294,12 +1325,12 @@
 unpack(): Object_T {
   return new Object_T(
     this.name(),
-    this.bb!.createObjList(this.fields.bind(this), this.fieldsLength()),
+    this.bb!.createObjList<Field, FieldT>(this.fields.bind(this), this.fieldsLength()),
     this.isStruct(),
     this.minalign(),
     this.bytesize(),
-    this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
-    this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+    this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()),
+    this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()),
     this.declarationFile()
   );
 }
@@ -1307,17 +1338,17 @@
 
 unpackTo(_o: Object_T): void {
   _o.name = this.name();
-  _o.fields = this.bb!.createObjList(this.fields.bind(this), this.fieldsLength());
+  _o.fields = this.bb!.createObjList<Field, FieldT>(this.fields.bind(this), this.fieldsLength());
   _o.isStruct = this.isStruct();
   _o.minalign = this.minalign();
   _o.bytesize = this.bytesize();
-  _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
-  _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+  _o.attributes = this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength());
+  _o.documentation = this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength());
   _o.declarationFile = this.declarationFile();
 }
 }
 
-export class Object_T {
+export class Object_T implements flatbuffers.IGeneratedObject {
 constructor(
   public name: string|Uint8Array|null = null,
   public fields: (FieldT)[] = [],
@@ -1350,7 +1381,7 @@
 }
 }
 
-export class RPCCall {
+export class RPCCall implements flatbuffers.IUnpackableObject<RPCCallT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):RPCCall {
@@ -1473,8 +1504,8 @@
     this.name(),
     (this.request() !== null ? this.request()!.unpack() : null),
     (this.response() !== null ? this.response()!.unpack() : null),
-    this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
-    this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength())
+    this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()),
+    this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength())
   );
 }
 
@@ -1483,12 +1514,12 @@
   _o.name = this.name();
   _o.request = (this.request() !== null ? this.request()!.unpack() : null);
   _o.response = (this.response() !== null ? this.response()!.unpack() : null);
-  _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
-  _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+  _o.attributes = this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength());
+  _o.documentation = this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength());
 }
 }
 
-export class RPCCallT {
+export class RPCCallT implements flatbuffers.IGeneratedObject {
 constructor(
   public name: string|Uint8Array|null = null,
   public request: Object_T|null = null,
@@ -1516,7 +1547,7 @@
 }
 }
 
-export class Service {
+export class Service implements flatbuffers.IUnpackableObject<ServiceT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Service {
@@ -1666,9 +1697,9 @@
 unpack(): ServiceT {
   return new ServiceT(
     this.name(),
-    this.bb!.createObjList(this.calls.bind(this), this.callsLength()),
-    this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
-    this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+    this.bb!.createObjList<RPCCall, RPCCallT>(this.calls.bind(this), this.callsLength()),
+    this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()),
+    this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()),
     this.declarationFile()
   );
 }
@@ -1676,14 +1707,14 @@
 
 unpackTo(_o: ServiceT): void {
   _o.name = this.name();
-  _o.calls = this.bb!.createObjList(this.calls.bind(this), this.callsLength());
-  _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
-  _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+  _o.calls = this.bb!.createObjList<RPCCall, RPCCallT>(this.calls.bind(this), this.callsLength());
+  _o.attributes = this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength());
+  _o.documentation = this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength());
   _o.declarationFile = this.declarationFile();
 }
 }
 
-export class ServiceT {
+export class ServiceT implements flatbuffers.IGeneratedObject {
 constructor(
   public name: string|Uint8Array|null = null,
   public calls: (RPCCallT)[] = [],
@@ -1715,7 +1746,7 @@
  * Symbols declared within a file may be recovered by iterating over all
  * symbols and examining the `declaration_file` field.
  */
-export class SchemaFile {
+export class SchemaFile implements flatbuffers.IUnpackableObject<SchemaFileT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):SchemaFile {
@@ -1802,18 +1833,18 @@
 unpack(): SchemaFileT {
   return new SchemaFileT(
     this.filename(),
-    this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength())
+    this.bb!.createScalarList<string>(this.includedFilenames.bind(this), this.includedFilenamesLength())
   );
 }
 
 
 unpackTo(_o: SchemaFileT): void {
   _o.filename = this.filename();
-  _o.includedFilenames = this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength());
+  _o.includedFilenames = this.bb!.createScalarList<string>(this.includedFilenames.bind(this), this.includedFilenamesLength());
 }
 }
 
-export class SchemaFileT {
+export class SchemaFileT implements flatbuffers.IGeneratedObject {
 constructor(
   public filename: string|Uint8Array|null = null,
   public includedFilenames: (string)[] = []
@@ -1831,7 +1862,7 @@
 }
 }
 
-export class Schema {
+export class Schema implements flatbuffers.IUnpackableObject<SchemaT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Schema {
@@ -2038,31 +2069,31 @@
 
 unpack(): SchemaT {
   return new SchemaT(
-    this.bb!.createObjList(this.objects.bind(this), this.objectsLength()),
-    this.bb!.createObjList(this.enums.bind(this), this.enumsLength()),
+    this.bb!.createObjList<Object_, Object_T>(this.objects.bind(this), this.objectsLength()),
+    this.bb!.createObjList<Enum, EnumT>(this.enums.bind(this), this.enumsLength()),
     this.fileIdent(),
     this.fileExt(),
     (this.rootTable() !== null ? this.rootTable()!.unpack() : null),
-    this.bb!.createObjList(this.services.bind(this), this.servicesLength()),
+    this.bb!.createObjList<Service, ServiceT>(this.services.bind(this), this.servicesLength()),
     this.advancedFeatures(),
-    this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength())
+    this.bb!.createObjList<SchemaFile, SchemaFileT>(this.fbsFiles.bind(this), this.fbsFilesLength())
   );
 }
 
 
 unpackTo(_o: SchemaT): void {
-  _o.objects = this.bb!.createObjList(this.objects.bind(this), this.objectsLength());
-  _o.enums = this.bb!.createObjList(this.enums.bind(this), this.enumsLength());
+  _o.objects = this.bb!.createObjList<Object_, Object_T>(this.objects.bind(this), this.objectsLength());
+  _o.enums = this.bb!.createObjList<Enum, EnumT>(this.enums.bind(this), this.enumsLength());
   _o.fileIdent = this.fileIdent();
   _o.fileExt = this.fileExt();
   _o.rootTable = (this.rootTable() !== null ? this.rootTable()!.unpack() : null);
-  _o.services = this.bb!.createObjList(this.services.bind(this), this.servicesLength());
+  _o.services = this.bb!.createObjList<Service, ServiceT>(this.services.bind(this), this.servicesLength());
   _o.advancedFeatures = this.advancedFeatures();
-  _o.fbsFiles = this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength());
+  _o.fbsFiles = this.bb!.createObjList<SchemaFile, SchemaFileT>(this.fbsFiles.bind(this), this.fbsFilesLength());
 }
 }
 
-export class SchemaT {
+export class SchemaT implements flatbuffers.IGeneratedObject {
 constructor(
   public objects: (Object_T)[] = [],
   public enums: (EnumT)[] = [],
diff --git a/tests/ts/ts-flat-files/monster_test_generated.ts b/tests/ts/ts-flat-files/monster_test_generated.ts
index 8a768f2..f1566c6 100644
--- a/tests/ts/ts-flat-files/monster_test_generated.ts
+++ b/tests/ts/ts-flat-files/monster_test_generated.ts
@@ -1152,8 +1152,48 @@
   return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('2');
 }
 
+nanDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 112);
+  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : NaN;
+}
+
+infDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 114);
+  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : Infinity;
+}
+
+positiveInfDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 116);
+  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : Infinity;
+}
+
+infinityDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 118);
+  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : Infinity;
+}
+
+positiveInfinityDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 120);
+  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : Infinity;
+}
+
+negativeInfDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 122);
+  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : -Infinity;
+}
+
+negativeInfinityDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 124);
+  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : -Infinity;
+}
+
+doubleInfDefault():number {
+  const offset = this.bb!.__offset(this.bb_pos, 126);
+  return offset ? this.bb!.readFloat64(this.bb_pos + offset) : Infinity;
+}
+
 static startMonster(builder:flatbuffers.Builder) {
-  builder.startObject(54);
+  builder.startObject(62);
 }
 
 static addPos(builder:flatbuffers.Builder, posOffset:flatbuffers.Offset) {
@@ -1589,6 +1629,38 @@
   builder.addFieldInt64(53, longEnumNormalDefault, BigInt('2'));
 }
 
+static addNanDefault(builder:flatbuffers.Builder, nanDefault:number) {
+  builder.addFieldFloat32(54, nanDefault, NaN);
+}
+
+static addInfDefault(builder:flatbuffers.Builder, infDefault:number) {
+  builder.addFieldFloat32(55, infDefault, Infinity);
+}
+
+static addPositiveInfDefault(builder:flatbuffers.Builder, positiveInfDefault:number) {
+  builder.addFieldFloat32(56, positiveInfDefault, Infinity);
+}
+
+static addInfinityDefault(builder:flatbuffers.Builder, infinityDefault:number) {
+  builder.addFieldFloat32(57, infinityDefault, Infinity);
+}
+
+static addPositiveInfinityDefault(builder:flatbuffers.Builder, positiveInfinityDefault:number) {
+  builder.addFieldFloat32(58, positiveInfinityDefault, Infinity);
+}
+
+static addNegativeInfDefault(builder:flatbuffers.Builder, negativeInfDefault:number) {
+  builder.addFieldFloat32(59, negativeInfDefault, -Infinity);
+}
+
+static addNegativeInfinityDefault(builder:flatbuffers.Builder, negativeInfinityDefault:number) {
+  builder.addFieldFloat32(60, negativeInfinityDefault, -Infinity);
+}
+
+static addDoubleInfDefault(builder:flatbuffers.Builder, doubleInfDefault:number) {
+  builder.addFieldFloat64(61, doubleInfDefault, Infinity);
+}
+
 static endMonster(builder:flatbuffers.Builder):flatbuffers.Offset {
   const offset = builder.endObject();
   builder.requiredField(offset, 10) // name
diff --git a/tests/ts/tsconfig.json b/tests/ts/tsconfig.json
index 27196b3..4678c63 100644
--- a/tests/ts/tsconfig.json
+++ b/tests/ts/tsconfig.json
@@ -20,6 +20,7 @@
     "typescript/**/*.ts",
     "optional_scalars/**/*.ts",
     "namespace_test/**/*.ts",
-    "union_vector/**/*.ts"
+    "union_vector/**/*.ts",
+    "arrays_test_complex/**/*.ts"
   ]
 }
diff --git a/tests/ts/typescript/object.ts b/tests/ts/typescript/object.ts
index 041b660..5baf6ed 100644
--- a/tests/ts/typescript/object.ts
+++ b/tests/ts/typescript/object.ts
@@ -8,7 +8,7 @@
 import { class_ } from '../typescript/class.js';
 
 
-export class Object_ {
+export class Object_ implements flatbuffers.IUnpackableObject<Object_T> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Object_ {
@@ -193,7 +193,7 @@
 }
 }
 
-export class Object_T {
+export class Object_T implements flatbuffers.IGeneratedObject {
 constructor(
   public return_: number = 0,
   public if_: number = 0,
diff --git a/tests/ts/typescript_keywords_generated.ts b/tests/ts/typescript_keywords_generated.ts
index 4272425..bcc6110 100644
--- a/tests/ts/typescript_keywords_generated.ts
+++ b/tests/ts/typescript_keywords_generated.ts
@@ -11,7 +11,7 @@
   instanceof_ = 1
 }
 
-export class Object_ {
+export class Object_ implements flatbuffers.IUnpackableObject<Object_T> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Object_ {
@@ -196,7 +196,7 @@
 }
 }
 
-export class Object_T {
+export class Object_T implements flatbuffers.IGeneratedObject {
 constructor(
   public return_: number = 0,
   public if_: number = 0,
diff --git a/tests/ts/union_vector/attacker.ts b/tests/ts/union_vector/attacker.ts
index 6b3fc0f..0d3ca4b 100644
--- a/tests/ts/union_vector/attacker.ts
+++ b/tests/ts/union_vector/attacker.ts
@@ -4,7 +4,7 @@
 
 
 
-export class Attacker {
+export class Attacker implements flatbuffers.IUnpackableObject<AttackerT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Attacker {
@@ -73,7 +73,7 @@
 }
 }
 
-export class AttackerT {
+export class AttackerT implements flatbuffers.IGeneratedObject {
 constructor(
   public swordAttackDamage: number = 0
 ){}
diff --git a/tests/ts/union_vector/book-reader.ts b/tests/ts/union_vector/book-reader.ts
index 7a31278..29a9b50 100644
--- a/tests/ts/union_vector/book-reader.ts
+++ b/tests/ts/union_vector/book-reader.ts
@@ -4,7 +4,7 @@
 
 
 
-export class BookReader {
+export class BookReader implements flatbuffers.IUnpackableObject<BookReaderT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):BookReader {
@@ -49,7 +49,7 @@
 }
 }
 
-export class BookReaderT {
+export class BookReaderT implements flatbuffers.IGeneratedObject {
 constructor(
   public booksRead: number = 0
 ){}
diff --git a/tests/ts/union_vector/falling-tub.ts b/tests/ts/union_vector/falling-tub.ts
index b32f99d..eeb9f72 100644
--- a/tests/ts/union_vector/falling-tub.ts
+++ b/tests/ts/union_vector/falling-tub.ts
@@ -4,7 +4,7 @@
 
 
 
-export class FallingTub {
+export class FallingTub implements flatbuffers.IUnpackableObject<FallingTubT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):FallingTub {
@@ -49,7 +49,7 @@
 }
 }
 
-export class FallingTubT {
+export class FallingTubT implements flatbuffers.IGeneratedObject {
 constructor(
   public weight: number = 0
 ){}
diff --git a/tests/ts/union_vector/hand-fan.ts b/tests/ts/union_vector/hand-fan.ts
index f90b4dd..dd687ba 100644
--- a/tests/ts/union_vector/hand-fan.ts
+++ b/tests/ts/union_vector/hand-fan.ts
@@ -4,7 +4,7 @@
 
 
 
-export class HandFan {
+export class HandFan implements flatbuffers.IUnpackableObject<HandFanT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):HandFan {
@@ -73,7 +73,7 @@
 }
 }
 
-export class HandFanT {
+export class HandFanT implements flatbuffers.IGeneratedObject {
 constructor(
   public length: number = 0
 ){}
diff --git a/tests/ts/union_vector/movie.js b/tests/ts/union_vector/movie.js
index 0245a43..53374eb 100644
--- a/tests/ts/union_vector/movie.js
+++ b/tests/ts/union_vector/movie.js
@@ -107,7 +107,7 @@
     }
     unpack() {
         return new MovieT(this.mainCharacterType(), (() => {
-            let temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this));
+            const temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this));
             if (temp === null) {
                 return null;
             }
@@ -116,13 +116,13 @@
             }
             return temp.unpack();
         })(), this.bb.createScalarList(this.charactersType.bind(this), this.charactersTypeLength()), (() => {
-            let ret = [];
+            const ret = [];
             for (let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) {
-                let targetEnum = this.charactersType(targetEnumIndex);
+                const targetEnum = this.charactersType(targetEnumIndex);
                 if (targetEnum === null || Character[targetEnum] === 'NONE') {
                     continue;
                 }
-                let temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex);
+                const temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex);
                 if (temp === null) {
                     continue;
                 }
@@ -138,7 +138,7 @@
     unpackTo(_o) {
         _o.mainCharacterType = this.mainCharacterType();
         _o.mainCharacter = (() => {
-            let temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this));
+            const temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this));
             if (temp === null) {
                 return null;
             }
@@ -149,13 +149,13 @@
         })();
         _o.charactersType = this.bb.createScalarList(this.charactersType.bind(this), this.charactersTypeLength());
         _o.characters = (() => {
-            let ret = [];
+            const ret = [];
             for (let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) {
-                let targetEnum = this.charactersType(targetEnumIndex);
+                const targetEnum = this.charactersType(targetEnumIndex);
                 if (targetEnum === null || Character[targetEnum] === 'NONE') {
                     continue;
                 }
-                let temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex);
+                const temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex);
                 if (temp === null) {
                     continue;
                 }
diff --git a/tests/ts/union_vector/movie.ts b/tests/ts/union_vector/movie.ts
index 6edeb53..a9f7553 100644
--- a/tests/ts/union_vector/movie.ts
+++ b/tests/ts/union_vector/movie.ts
@@ -8,7 +8,7 @@
 import { Rapunzel, RapunzelT } from './rapunzel.js';
 
 
-export class Movie {
+export class Movie implements flatbuffers.IUnpackableObject<MovieT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Movie {
@@ -139,19 +139,19 @@
   return new MovieT(
     this.mainCharacterType(),
     (() => {
-      let temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this));
+      const temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this));
       if(temp === null) { return null; }
       if(typeof temp === 'string') { return temp; }
       return temp.unpack()
   })(),
-    this.bb!.createScalarList(this.charactersType.bind(this), this.charactersTypeLength()),
+    this.bb!.createScalarList<Character>(this.charactersType.bind(this), this.charactersTypeLength()),
     (() => {
-    let ret = [];
+    const ret: (AttackerT|BookReaderT|RapunzelT|string)[] = [];
     for(let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) {
-      let targetEnum = this.charactersType(targetEnumIndex);
+      const targetEnum = this.charactersType(targetEnumIndex);
       if(targetEnum === null || Character[targetEnum!] === 'NONE') { continue; }
 
-      let temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex);
+      const temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex);
       if(temp === null) { continue; }
       if(typeof temp === 'string') { ret.push(temp); continue; }
       ret.push(temp.unpack());
@@ -165,19 +165,19 @@
 unpackTo(_o: MovieT): void {
   _o.mainCharacterType = this.mainCharacterType();
   _o.mainCharacter = (() => {
-      let temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this));
+      const temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this));
       if(temp === null) { return null; }
       if(typeof temp === 'string') { return temp; }
       return temp.unpack()
   })();
-  _o.charactersType = this.bb!.createScalarList(this.charactersType.bind(this), this.charactersTypeLength());
+  _o.charactersType = this.bb!.createScalarList<Character>(this.charactersType.bind(this), this.charactersTypeLength());
   _o.characters = (() => {
-    let ret = [];
+    const ret: (AttackerT|BookReaderT|RapunzelT|string)[] = [];
     for(let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) {
-      let targetEnum = this.charactersType(targetEnumIndex);
+      const targetEnum = this.charactersType(targetEnumIndex);
       if(targetEnum === null || Character[targetEnum!] === 'NONE') { continue; }
 
-      let temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex);
+      const temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex);
       if(temp === null) { continue; }
       if(typeof temp === 'string') { ret.push(temp); continue; }
       ret.push(temp.unpack());
@@ -187,7 +187,7 @@
 }
 }
 
-export class MovieT {
+export class MovieT implements flatbuffers.IGeneratedObject {
 constructor(
   public mainCharacterType: Character = Character.NONE,
   public mainCharacter: AttackerT|BookReaderT|RapunzelT|string|null = null,
diff --git a/tests/ts/union_vector/rapunzel.ts b/tests/ts/union_vector/rapunzel.ts
index e1dc63d..20ca497 100644
--- a/tests/ts/union_vector/rapunzel.ts
+++ b/tests/ts/union_vector/rapunzel.ts
@@ -4,7 +4,7 @@
 
 
 
-export class Rapunzel {
+export class Rapunzel implements flatbuffers.IUnpackableObject<RapunzelT> {
   bb: flatbuffers.ByteBuffer|null = null;
   bb_pos = 0;
   __init(i:number, bb:flatbuffers.ByteBuffer):Rapunzel {
@@ -49,7 +49,7 @@
 }
 }
 
-export class RapunzelT {
+export class RapunzelT implements flatbuffers.IGeneratedObject {
 constructor(
   public hairLength: number = 0
 ){}