Squashed 'third_party/flatbuffers/' changes from e5f331db9..bc44fad35

bc44fad35 UnPackTo disable merge by default (#7527)
4fca4dc60 [TS/JS] Move TS tests to dedicated folder and deps upgrade (#7508)
036032373 Bump junit from 4.13 to 4.13.1 in /java (#7526)
89dfb43f3 Replace `bash JavaTest.sh` with `mvn test` (#7500)
c49aff4b6 enabled cpp17 tests in CI (#7524)
56e60223c prevent force_align attribute on enums (#7523)
89b1f5aa1 remove travis config (#7522)
b90159823 [Java][Flexbuffers] Add API to add nullables into the buffer. (#7521)
8cdc6a288 Install BuildFlatBuffers.cmake (#7519)
a67e35aff Moves all of the swift test code into tests/swift (#7509)
f124e41ae Updated Readme
4c954181c [Java][FlexBuffers] throwing exception for untyped fixed vectors (#7507)
7f7547737 [Android] Remove maven dependency of flatbuffers and use source folder (#7503)
a79d61ea8 Fixes issue with cocoapods failing to be published because of docc (#7505)
d465b39c3 [CMake]: fix breaking find_package change (#7499) (#7502)
c5a609dc2 [C#] Prepares for official Nuget release (#7496)
5634dc3d0 [ISSUE-6268] returns NaN insteadof nan (#7498)
37e37b8ca Updates cocoapods version (#7497)
8fd4534fb update android multidex setting (#7495)
d5427da52 Disable Android Build (#7494)
06c5c7ed0 FlatBuffers Version 2.0.8 (#7492)
b190ce11b Verifier Refinements (#7490)
bf5d23230 Namer applied to Typescript generator (#7488)
ce382d6dd [TS/JS] Add rollup and config to generate iife flatbuffers bundle (#7449)
41d9add7e C++: Add option to skip verifying nested flatbuffers (#7489)
6a8742754 [C++] support native_inline attribute for vector of tables (#7479)
694add668 Refactor test.cpp (#7487)
7edf8c908 Update scorecard to 1.1.2
b86387442 Fix typos (#7483)
e2eb5ee67 Include <array> head in stl_emulation.h (#7480)
994502b6d Version number in file package.json updated to 2.0.7 (#7476)
fa41e8367 [C++] Fixed crash when copying table with empty shared strings (#7477)
799cc8f7b Use type traits for specialization (#7475)
b7eb44147 Disable RTTI and rework use in idl_gen_ts.cpp (#7474)
8d01c5859 CMake project version detection made more robust (#7473)
237e8b71f Moved compiler warnings around (#7471)
eeb8fd60d Include builder.addOffset for vector of structs (#7470)
fef2ffc4d Use schema include name for keep-prefix (#7469)
8367664f1 Flatbuffers Version 2.0.7 (#7462)
d6f06c33f Reworked keep prefix (#7456)
627e8bf36 update grpc version (#7457)
883c42b7d disabling unpackto optimization (#7459)
7aae0af30 Remove old GRPC bash script and convert to python3 (#7454)
b057aa917 Grouped anonymous namespaces together, (#7455)
f1b26ff7f Change to GetTypeName (#7453)
9610a666b Generate SLSA signatures for Released zip files (#7450)
1e0f75a64 [WIP] speedup (#7452)
82b75407a Wrap types in namespace for --ts-flat-files and --gen-all (#7451)
f7c511957 Audit and fixups for GCC and Clang (#7212)
a66de58af Partial support for --ts-flat-files and --gen-all (#7446)
a3508f36d [Kotlin] Make sure namespace path exist for code generation (#7357)
137fec716 Stop using __has_trivial_copy on recent clang versions. (#7443)
214125e41 [C#] Rework how sorted vectors are looked up (#7441)
44a7dc999 Define minimum buffer size (#7440)
3cc2daa78 make_span overloads for pointer to vector (#7374) (#7435)
fa1174aa7 [TypeScript] Fix namespaceless schema generation (#7432)
83d4e2a10 Add checks to verifier (#7438)
8a09f3fb0 Fix FlexBuffers JS/TS bug https://github.com/google/flatbuffers/issues/6934 (#7434)
9dbe819ef Add flatc python tests to CI (#7437)
67c414958 Update TypeScriptTest.py to work better cross platform (#7436)
8b8c7dbdf Update gitingore to reflect name change (#7431)
2ee20a5f3 Remove auto including locale functions (#7430)
4be605604 [C++] Set StructDef::has_key property when deserializing from binary schema (#7386) (#7428)
fc5d86f1e [C++] Make template parameter in stl_emulation.h more explicit to avoid conflicts with cpprestsdk U macro (#7424)
9dce287ad Issue#6959 :Updated Automatically generated rust files. (#7425)
7798be3bb avoid zero-as-null-pointer warning (#7423)
966362e07 [C++] Vector of Tables equality (#7415)
a89c279ed [golang] Perform keyword escaping after case conversion (#7421)
a212b3c03 Turn of fail fast for C++ CI
9230f600d Remove stringop-overflow from error (#7422)
c79362156 [golang] Add support for text parsing with json struct tags (#7353)
ee2ced236 Moved TypeScriptTests to python script (#7411)
468c00a3f Rebased: grpc/compiler: Respect filename suffix and extension during code generation (#7414)
47c757f71 Add tests for flatc (#7405)
9a5ff8900 Add FLATBUFFERS_STRICT_MODE (#7408)
950444a34 [TS] Use TextEncoder and TextDecoder (#7400)
30d76198c Compilation issue msys2 #7399 (#7409)
cce3a66f0 Delete .travis directory
8d1cc6ac7 Revert "Compilation issue msys2 (#7403)" (#7407)
5b207639a Update readme.md
359e0f9d6 Revert "grpc/compiler: Respect filename suffix and extension during code generation (#7343)" (#7406)
ebbed0513 Delete cpp-linter.yml
aa395e5a5 (#7323) Rename CMake files according to project name (#7378)
32328075d Fix error msg format when generate GRPC failed (#7350)
97e89c5ac grpc/compiler: Respect filename suffix and extension during code generation (#7343)
5f6672be4 Fix Clang-Cl compile on Windows (#7308)
28e858c85 [TS/Bazel] Minor improvements to typescript.bzl (#7300)
987bebe67 [TS] fix incorrect reverse when writting array of structs (#7271)
ec0129369 Fix FlexBuffers Verifier tracking vectors reuse at wrong offset
50dd385b3 Add missing const (#7401)
da702cfd8 Compilation issue msys2 (#7403)
6e2791640 keep-prefix keeps relative pathing (#7394)
52fce5e53 fix(#7360): grpc used deprecated functions (#7361)
b7f13cd8e cpp_generator: comment out unused parameter to avoid warnings (#7381)
e42985e5a Updated Newtonsoft.Json to 13.0.1 (#7393)
0a8064637 Fix references to LICENSE file (#7377)
b9eea76a8 [Dart] Implement putBool to fix errors when serializing structs with bools (#7359)
1b9030015 Bump Newtonsoft.Json from 12.0.3 to 13.0.1 in /tests/FlatBuffers.Test (#7363)
83a43fc79 Reenable optional json (#7352)
5f0137602 Only include direct included filed (#7348)
9a1913a87 Revert "Implement optional scalars for JSON (#7322)" (#7351)
b4647beb8 Revert "Move reflection_ts_fbs into a separate directory (#7342)" (#7349)
d6060977a Remove asserting in verifier for flattests
987aa5b5e move -Wextra-semi to GCC 8.0+
42acdb63c [TS] Don't generate self-imports with --ts-flat-file (#7340)
0cc1aeb8c [golang] Create missing namespace directory structure (#7324) (#7325)
ba6c67170 [Kotlin] Remove download benchmark files dependency (#7314)
d2f33fc45 Disable Android on Linux CI build
0d1b72cbc [TS] fix ts import path issue (#7298)
9fce2fbf2 replace io/ioutil to os (#7281)
a18ea40d6 Implement optional scalars for JSON (#7322)
090caa280 Move reflection_ts_fbs into a separate directory (#7342)
49e1ea333 Implement optional scalars for Python (#7318)
11a198870 Started implementation for private flags in rust (#7269)
967df08b1 Adds full supposed for Wasm in the swift lib (#7328)
9aa08a429 Use keep case for Rust union discriminant type. (#7321)
9e8c758f5 Add explicit return types to lobster generated code (#7312)
74a25536b Add size check to fix out of bounds read risk (#7304)
12917af8a Update Rust docs page (#7296)
1ea2472f7 [swift] add had<ArrayName> property for arrays to check presence in a message (#7280)
0fe13cb28 Remove span ConstIterator/cbegin()/cend(). (#7295)
385dddc66 Namerkot (#7245)
750dde766 Make `flatc` generate Rust files not requiring `std` (#7273)
9917a168c [swift] Make swift module public (#7274)
76d3cca19 Rust: fix a name conflict when building with "no_std" feature (#7268)
c86e6d0e3 json inf parsing
d34dc32c2 fix include order
234d86c92 fixed off-by-one in parser
746c73b91 Add Annotations for Monster schema and example buffer
0bbfd4b2e fixes for annotator
716521953 Update readme.md (#7257)
a45f564cf [performance] Add aggressive systematic inlining in ByteBuffer and FlatBufferBuilder (#7253)
9d45a6403 more google merge fixes
ccfb4c20b Handle +/-inf in protos (#7256)
7bcd857b8 Specialize CreateVector with std::initializer_list (#7254)
23c8ab34c Swift update performance benchmark infrastructure (#7255)
70002dc5c various fixes for google merge
6e0e79f24 Add test for nested buffer verifier (#7252)
b856368d7 Turn off go modules temporary until we get a proper fix (#7251)
e37156a30 Keep the underlying storage capacity when clearing the FlatBufferBuilder. Gives a significant performance boost for serialisation of many small messages. (#7250)
a10b0e546 Java namer variable keep case (#7249)
275b73994 allow overriding FLATBUFFERS_MAX_ALIGNMENT
9d1ce9a10 Add parameter back to EndVector (#7246)
79afe6c3d Make Java namespaces keep case by default (#7243)
c6dbb2230 Add write permissions for labeller
18bacd3ea Expand test to make sure {}-initializers are properly understood by template. (#7242)
a2c913aec Add -Wnon-virtual-dtor
67b33b294 set workflows permissions to read-only (#7239)
7b5fd2bd0 [Kotlin] Fix key lookup returning null clashing with default value (#7237)
7181d7770 [Java] Fix key lookup returning null clashing with default value (#7236)
7f663b120 Allow CreateVectorOfStrings() to work with any string-type. (#7238)
173ebb694 Fixes a bug where the create function doesnt optional + required items (#7228)
d65823948 [Kotlin] Update gradle to 7.4.1 and simplify config files. (#7231)
ab4bf59e8 remove toascii (#7234)
eee44bbb2 disable cpp-linter (#7229)
a63fa51a1 Create cpp-linter.yml (#7208)
2049e5210 Adds a way to verify/exposes Entities ids (#7221)
832c618f5 Adds implementation flag for swift (#7202)
14615699f Started to migrate to target_compile_options (#7222)
20aad0c41 [C++] stl_emulation span::count_ is not const anymore (#7226) (#7227)
f083b33f2 code gen flexbuffer verifier (#7207)
bf17df346 [C++] generate sorted #include directives (#7213)
35281dedb Fix for [C++] flatc generates invalid Code in the default constructor for structs, when --cpp-field-case-style is used #7209 (#7211)
c9651b742 Add overloads for C# ByteBuffer/FlatBufferBuilder to allow adding vector blocks from ArraySegments or IntPtr (#7193)
26c3b3ada Update codeql.yml
da6e1b985 Update codeql.yml
ad27d751e Added Oss fuzz badge
0aab623cb Create codeql.yml
6a446bdd8 maximize parallel builds in CI (#7206)
21fb5cbbc Create scorecards.yml
0da6f9486 [C++] Static assert on Flatbuffers Version (#7203)
59e971308 reduce fuzzing time to 1 minute in CI
40866a892 fixed padding in struct for annotated binary (#7199)
b71d968fa Apply Namer prefix/suffix to other generators (#7197)
fac0d7be0 Apply Namer to Java. (#7194)
6c5603fd9 [C#] Fix collision of field name and type name (#7149)
2d21853a7 monster fuzzer fix for json default scalars
fec1a8d01 [swift] Add bazel configuration for Swift (#7195)
7fd857623 structured comments (#7192)
a4cb1599d Namerdart (#7187)
ae4ce7265 fuzzed binary annotator (#7188)
e2be0c0b0 Handle root offset and root table vtable invalidation (#7177)
2ad408697 [TS] Fix generation of struct members in object api (#7148)
4213d9105 VerifySizePrefixed (reflection::Schema) and GetAnySizePrefixedRoot added (#7181)
5a13f622c Correctly parse lists of enums in Dart generated code (#7157)
23a7e4e0b Adds no-includes flags to the swift code generator (#7182)
eeb49c275 Move flatbuffer_ts_library to typescript.bzl (#7183)
824763b31 Typo in flatc options (warning-as-errors instead of warnings-as-errors) (#7180)
d3aeee32b Annotated Flatbuffer Binary (#7174)
0bceba24d [Lua] Apply Namer to Lua (#7171)
b8c77d404 Make inclusion of header <optional> opt-out via macro (#7168)
8468eab83 Namersw (#7167)
2b2e8d4ae Nameroverloads (#7164)
b80b32bfa Use DESCRIPTION only if CMake version >= 3.9 (#7166)

Change-Id: Ic2681dabb1a798b7515e62753ee06aecb9933260
git-subtree-dir: third_party/flatbuffers
git-subtree-split: bc44fad35271e43fd7a79b4d691ac9e41708797f
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/tests/ts/reflection/advanced-features.ts b/tests/ts/reflection/advanced-features.ts
new file mode 100644
index 0000000..dd3b865
--- /dev/null
+++ b/tests/ts/reflection/advanced-features.ts
@@ -0,0 +1,11 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+/**
+ * New schema language features that are not supported by old code generators.
+ */
+export enum AdvancedFeatures {
+  AdvancedArrayFeatures = '1',
+  AdvancedUnionFeatures = '2',
+  OptionalScalars = '4',
+  DefaultVectorsAndStrings = '8'
+}
diff --git a/tests/ts/reflection/base-type.js b/tests/ts/reflection/base-type.js
new file mode 100644
index 0000000..dccd0ac
--- /dev/null
+++ b/tests/ts/reflection/base-type.js
@@ -0,0 +1,23 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+export var BaseType;
+(function (BaseType) {
+    BaseType[BaseType["None"] = 0] = "None";
+    BaseType[BaseType["UType"] = 1] = "UType";
+    BaseType[BaseType["Bool"] = 2] = "Bool";
+    BaseType[BaseType["Byte"] = 3] = "Byte";
+    BaseType[BaseType["UByte"] = 4] = "UByte";
+    BaseType[BaseType["Short"] = 5] = "Short";
+    BaseType[BaseType["UShort"] = 6] = "UShort";
+    BaseType[BaseType["Int"] = 7] = "Int";
+    BaseType[BaseType["UInt"] = 8] = "UInt";
+    BaseType[BaseType["Long"] = 9] = "Long";
+    BaseType[BaseType["ULong"] = 10] = "ULong";
+    BaseType[BaseType["Float"] = 11] = "Float";
+    BaseType[BaseType["Double"] = 12] = "Double";
+    BaseType[BaseType["String"] = 13] = "String";
+    BaseType[BaseType["Vector"] = 14] = "Vector";
+    BaseType[BaseType["Obj"] = 15] = "Obj";
+    BaseType[BaseType["Union"] = 16] = "Union";
+    BaseType[BaseType["Array"] = 17] = "Array";
+    BaseType[BaseType["MaxBaseType"] = 18] = "MaxBaseType";
+})(BaseType || (BaseType = {}));
diff --git a/tests/ts/reflection/base-type.ts b/tests/ts/reflection/base-type.ts
new file mode 100644
index 0000000..7ee98ed
--- /dev/null
+++ b/tests/ts/reflection/base-type.ts
@@ -0,0 +1,23 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+export enum BaseType {
+  None = 0,
+  UType = 1,
+  Bool = 2,
+  Byte = 3,
+  UByte = 4,
+  Short = 5,
+  UShort = 6,
+  Int = 7,
+  UInt = 8,
+  Long = 9,
+  ULong = 10,
+  Float = 11,
+  Double = 12,
+  String = 13,
+  Vector = 14,
+  Obj = 15,
+  Union = 16,
+  Array = 17,
+  MaxBaseType = 18
+}
diff --git a/tests/ts/reflection/enum-val.js b/tests/ts/reflection/enum-val.js
new file mode 100644
index 0000000..f2ce03d
--- /dev/null
+++ b/tests/ts/reflection/enum-val.js
@@ -0,0 +1,110 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { Type } from '../reflection/type.js';
+export class EnumVal {
+    constructor() {
+        this.bb = null;
+        this.bb_pos = 0;
+    }
+    __init(i, bb) {
+        this.bb_pos = i;
+        this.bb = bb;
+        return this;
+    }
+    static getRootAsEnumVal(bb, obj) {
+        return (obj || new EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    static getSizePrefixedRootAsEnumVal(bb, obj) {
+        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+        return (obj || new EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    name(optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 4);
+        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+    }
+    value() {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
+    }
+    mutate_value(value) {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeInt64(this.bb_pos + offset, value);
+        return true;
+    }
+    unionType(obj) {
+        const offset = this.bb.__offset(this.bb_pos, 10);
+        return offset ? (obj || new Type()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+    }
+    documentation(index, optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 12);
+        return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+    }
+    documentationLength() {
+        const offset = this.bb.__offset(this.bb_pos, 12);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    static getFullyQualifiedName() {
+        return 'reflection_EnumVal';
+    }
+    static startEnumVal(builder) {
+        builder.startObject(5);
+    }
+    static addName(builder, nameOffset) {
+        builder.addFieldOffset(0, nameOffset, 0);
+    }
+    static addValue(builder, value) {
+        builder.addFieldInt64(1, value, BigInt('0'));
+    }
+    static addUnionType(builder, unionTypeOffset) {
+        builder.addFieldOffset(3, unionTypeOffset, 0);
+    }
+    static addDocumentation(builder, documentationOffset) {
+        builder.addFieldOffset(4, documentationOffset, 0);
+    }
+    static createDocumentationVector(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 startDocumentationVector(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()));
+    }
+    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());
+    }
+}
+export class EnumValT {
+    constructor(name = null, value = BigInt('0'), unionType = null, documentation = []) {
+        this.name = name;
+        this.value = value;
+        this.unionType = unionType;
+        this.documentation = documentation;
+    }
+    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));
+        EnumVal.startEnumVal(builder);
+        EnumVal.addName(builder, name);
+        EnumVal.addValue(builder, this.value);
+        EnumVal.addUnionType(builder, unionType);
+        EnumVal.addDocumentation(builder, documentation);
+        return EnumVal.endEnumVal(builder);
+    }
+}
diff --git a/tests/ts/reflection/enum-val.ts b/tests/ts/reflection/enum-val.ts
new file mode 100644
index 0000000..8527832
--- /dev/null
+++ b/tests/ts/reflection/enum-val.ts
@@ -0,0 +1,149 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { Type, TypeT } from '../reflection/type.js';
+
+
+export class EnumVal {
+  bb: flatbuffers.ByteBuffer|null = null;
+  bb_pos = 0;
+  __init(i:number, bb:flatbuffers.ByteBuffer):EnumVal {
+  this.bb_pos = i;
+  this.bb = bb;
+  return this;
+}
+
+static getRootAsEnumVal(bb:flatbuffers.ByteBuffer, obj?:EnumVal):EnumVal {
+  return (obj || new EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsEnumVal(bb:flatbuffers.ByteBuffer, obj?:EnumVal):EnumVal {
+  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+  return (obj || new EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+name():string|null
+name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+name(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;
+}
+
+value():bigint {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_value(value:bigint):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeInt64(this.bb_pos + offset, value);
+  return true;
+}
+
+unionType(obj?:Type):Type|null {
+  const offset = this.bb!.__offset(this.bb_pos, 10);
+  return offset ? (obj || new Type()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+  const offset = this.bb!.__offset(this.bb_pos, 12);
+  return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 12);
+  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);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addValue(builder:flatbuffers.Builder, value:bigint) {
+  builder.addFieldInt64(1, value, BigInt('0'));
+}
+
+static addUnionType(builder:flatbuffers.Builder, unionTypeOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(3, unionTypeOffset, 0);
+}
+
+static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(4, documentationOffset, 0);
+}
+
+static createDocumentationVector(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 startDocumentationVector(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
+  return offset;
+}
+
+
+unpack(): EnumValT {
+  return new EnumValT(
+    this.name(),
+    this.value(),
+    (this.unionType() !== null ? this.unionType()!.unpack() : null),
+    this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength())
+  );
+}
+
+
+unpackTo(_o: EnumValT): void {
+  _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());
+}
+}
+
+export class EnumValT {
+constructor(
+  public name: string|Uint8Array|null = null,
+  public value: bigint = BigInt('0'),
+  public unionType: TypeT|null = null,
+  public documentation: (string)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+  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));
+
+  EnumVal.startEnumVal(builder);
+  EnumVal.addName(builder, name);
+  EnumVal.addValue(builder, this.value);
+  EnumVal.addUnionType(builder, unionType);
+  EnumVal.addDocumentation(builder, documentation);
+
+  return EnumVal.endEnumVal(builder);
+}
+}
diff --git a/tests/ts/reflection/enum.js b/tests/ts/reflection/enum.js
new file mode 100644
index 0000000..4939307
--- /dev/null
+++ b/tests/ts/reflection/enum.js
@@ -0,0 +1,175 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { EnumVal } from '../reflection/enum-val.js';
+import { KeyValue } from '../reflection/key-value.js';
+import { Type } from '../reflection/type.js';
+export class Enum {
+    constructor() {
+        this.bb = null;
+        this.bb_pos = 0;
+    }
+    __init(i, bb) {
+        this.bb_pos = i;
+        this.bb = bb;
+        return this;
+    }
+    static getRootAsEnum(bb, obj) {
+        return (obj || new Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    static getSizePrefixedRootAsEnum(bb, obj) {
+        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+        return (obj || new Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    name(optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 4);
+        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+    }
+    values(index, obj) {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? (obj || new EnumVal()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+    }
+    valuesLength() {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    isUnion() {
+        const offset = this.bb.__offset(this.bb_pos, 8);
+        return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+    }
+    mutate_is_union(value) {
+        const offset = this.bb.__offset(this.bb_pos, 8);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeInt8(this.bb_pos + offset, +value);
+        return true;
+    }
+    underlyingType(obj) {
+        const offset = this.bb.__offset(this.bb_pos, 10);
+        return offset ? (obj || new Type()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+    }
+    attributes(index, obj) {
+        const offset = this.bb.__offset(this.bb_pos, 12);
+        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, 12);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    documentation(index, optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 14);
+        return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+    }
+    documentationLength() {
+        const offset = this.bb.__offset(this.bb_pos, 14);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    declarationFile(optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 16);
+        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+    }
+    static getFullyQualifiedName() {
+        return 'reflection_Enum';
+    }
+    static startEnum(builder) {
+        builder.startObject(7);
+    }
+    static addName(builder, nameOffset) {
+        builder.addFieldOffset(0, nameOffset, 0);
+    }
+    static addValues(builder, valuesOffset) {
+        builder.addFieldOffset(1, valuesOffset, 0);
+    }
+    static createValuesVector(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 startValuesVector(builder, numElems) {
+        builder.startVector(4, numElems, 4);
+    }
+    static addIsUnion(builder, isUnion) {
+        builder.addFieldInt8(2, +isUnion, +false);
+    }
+    static addUnderlyingType(builder, underlyingTypeOffset) {
+        builder.addFieldOffset(3, underlyingTypeOffset, 0);
+    }
+    static addAttributes(builder, attributesOffset) {
+        builder.addFieldOffset(4, 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 addDocumentation(builder, documentationOffset) {
+        builder.addFieldOffset(5, documentationOffset, 0);
+    }
+    static createDocumentationVector(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 startDocumentationVector(builder, numElems) {
+        builder.startVector(4, numElems, 4);
+    }
+    static addDeclarationFile(builder, declarationFileOffset) {
+        builder.addFieldOffset(6, declarationFileOffset, 0);
+    }
+    static endEnum(builder) {
+        const offset = builder.endObject();
+        builder.requiredField(offset, 4); // name
+        builder.requiredField(offset, 6); // values
+        builder.requiredField(offset, 10); // underlying_type
+        return offset;
+    }
+    unpack() {
+        return new EnumT(this.name(), this.bb.createObjList(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.declarationFile());
+    }
+    unpackTo(_o) {
+        _o.name = this.name();
+        _o.values = this.bb.createObjList(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.declarationFile = this.declarationFile();
+    }
+}
+export class EnumT {
+    constructor(name = null, values = [], isUnion = false, underlyingType = null, attributes = [], documentation = [], declarationFile = null) {
+        this.name = name;
+        this.values = values;
+        this.isUnion = isUnion;
+        this.underlyingType = underlyingType;
+        this.attributes = attributes;
+        this.documentation = documentation;
+        this.declarationFile = declarationFile;
+    }
+    pack(builder) {
+        const name = (this.name !== null ? builder.createString(this.name) : 0);
+        const values = Enum.createValuesVector(builder, builder.createObjectOffsetList(this.values));
+        const underlyingType = (this.underlyingType !== null ? this.underlyingType.pack(builder) : 0);
+        const attributes = Enum.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+        const documentation = Enum.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+        const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile) : 0);
+        Enum.startEnum(builder);
+        Enum.addName(builder, name);
+        Enum.addValues(builder, values);
+        Enum.addIsUnion(builder, this.isUnion);
+        Enum.addUnderlyingType(builder, underlyingType);
+        Enum.addAttributes(builder, attributes);
+        Enum.addDocumentation(builder, documentation);
+        Enum.addDeclarationFile(builder, declarationFile);
+        return Enum.endEnum(builder);
+    }
+}
diff --git a/tests/ts/reflection/enum.ts b/tests/ts/reflection/enum.ts
new file mode 100644
index 0000000..7bba354
--- /dev/null
+++ b/tests/ts/reflection/enum.ts
@@ -0,0 +1,234 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { EnumVal, EnumValT } from '../reflection/enum-val.js';
+import { KeyValue, KeyValueT } from '../reflection/key-value.js';
+import { Type, TypeT } from '../reflection/type.js';
+
+
+export class Enum {
+  bb: flatbuffers.ByteBuffer|null = null;
+  bb_pos = 0;
+  __init(i:number, bb:flatbuffers.ByteBuffer):Enum {
+  this.bb_pos = i;
+  this.bb = bb;
+  return this;
+}
+
+static getRootAsEnum(bb:flatbuffers.ByteBuffer, obj?:Enum):Enum {
+  return (obj || new Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsEnum(bb:flatbuffers.ByteBuffer, obj?:Enum):Enum {
+  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+  return (obj || new Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+name():string|null
+name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+name(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;
+}
+
+values(index: number, obj?:EnumVal):EnumVal|null {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  return offset ? (obj || new EnumVal()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+valuesLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+isUnion():boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 8);
+  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_is_union(value:boolean):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 8);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeInt8(this.bb_pos + offset, +value);
+  return true;
+}
+
+underlyingType(obj?:Type):Type|null {
+  const offset = this.bb!.__offset(this.bb_pos, 10);
+  return offset ? (obj || new Type()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+attributes(index: number, obj?:KeyValue):KeyValue|null {
+  const offset = this.bb!.__offset(this.bb_pos, 12);
+  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, 12);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+  const offset = this.bb!.__offset(this.bb_pos, 14);
+  return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 14);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+/**
+ * File that this Enum is declared in.
+ */
+declarationFile():string|null
+declarationFile(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+declarationFile(optionalEncoding?:any):string|Uint8Array|null {
+  const offset = this.bb!.__offset(this.bb_pos, 16);
+  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+static getFullyQualifiedName():string {
+  return 'reflection_Enum';
+}
+
+static startEnum(builder:flatbuffers.Builder) {
+  builder.startObject(7);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addValues(builder:flatbuffers.Builder, valuesOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(1, valuesOffset, 0);
+}
+
+static createValuesVector(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 startValuesVector(builder:flatbuffers.Builder, numElems:number) {
+  builder.startVector(4, numElems, 4);
+}
+
+static addIsUnion(builder:flatbuffers.Builder, isUnion:boolean) {
+  builder.addFieldInt8(2, +isUnion, +false);
+}
+
+static addUnderlyingType(builder:flatbuffers.Builder, underlyingTypeOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(3, underlyingTypeOffset, 0);
+}
+
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(4, 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 addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(5, documentationOffset, 0);
+}
+
+static createDocumentationVector(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 startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+  builder.startVector(4, numElems, 4);
+}
+
+static addDeclarationFile(builder:flatbuffers.Builder, declarationFileOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(6, declarationFileOffset, 0);
+}
+
+static endEnum(builder:flatbuffers.Builder):flatbuffers.Offset {
+  const offset = builder.endObject();
+  builder.requiredField(offset, 4) // name
+  builder.requiredField(offset, 6) // values
+  builder.requiredField(offset, 10) // underlying_type
+  return offset;
+}
+
+
+unpack(): EnumT {
+  return new EnumT(
+    this.name(),
+    this.bb!.createObjList(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.declarationFile()
+  );
+}
+
+
+unpackTo(_o: EnumT): void {
+  _o.name = this.name();
+  _o.values = this.bb!.createObjList(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.declarationFile = this.declarationFile();
+}
+}
+
+export class EnumT {
+constructor(
+  public name: string|Uint8Array|null = null,
+  public values: (EnumValT)[] = [],
+  public isUnion: boolean = false,
+  public underlyingType: TypeT|null = null,
+  public attributes: (KeyValueT)[] = [],
+  public documentation: (string)[] = [],
+  public declarationFile: string|Uint8Array|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+  const name = (this.name !== null ? builder.createString(this.name!) : 0);
+  const values = Enum.createValuesVector(builder, builder.createObjectOffsetList(this.values));
+  const underlyingType = (this.underlyingType !== null ? this.underlyingType!.pack(builder) : 0);
+  const attributes = Enum.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+  const documentation = Enum.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+  const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile!) : 0);
+
+  Enum.startEnum(builder);
+  Enum.addName(builder, name);
+  Enum.addValues(builder, values);
+  Enum.addIsUnion(builder, this.isUnion);
+  Enum.addUnderlyingType(builder, underlyingType);
+  Enum.addAttributes(builder, attributes);
+  Enum.addDocumentation(builder, documentation);
+  Enum.addDeclarationFile(builder, declarationFile);
+
+  return Enum.endEnum(builder);
+}
+}
diff --git a/tests/ts/reflection/field.js b/tests/ts/reflection/field.js
new file mode 100644
index 0000000..107b77b
--- /dev/null
+++ b/tests/ts/reflection/field.js
@@ -0,0 +1,284 @@
+// 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 Field {
+    constructor() {
+        this.bb = null;
+        this.bb_pos = 0;
+    }
+    __init(i, bb) {
+        this.bb_pos = i;
+        this.bb = bb;
+        return this;
+    }
+    static getRootAsField(bb, obj) {
+        return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    static getSizePrefixedRootAsField(bb, obj) {
+        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+        return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    name(optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 4);
+        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+    }
+    type(obj) {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? (obj || new Type()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+    }
+    id() {
+        const offset = this.bb.__offset(this.bb_pos, 8);
+        return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
+    }
+    mutate_id(value) {
+        const offset = this.bb.__offset(this.bb_pos, 8);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeUint16(this.bb_pos + offset, value);
+        return true;
+    }
+    offset() {
+        const offset = this.bb.__offset(this.bb_pos, 10);
+        return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
+    }
+    mutate_offset(value) {
+        const offset = this.bb.__offset(this.bb_pos, 10);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeUint16(this.bb_pos + offset, value);
+        return true;
+    }
+    defaultInteger() {
+        const offset = this.bb.__offset(this.bb_pos, 12);
+        return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
+    }
+    mutate_default_integer(value) {
+        const offset = this.bb.__offset(this.bb_pos, 12);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeInt64(this.bb_pos + offset, value);
+        return true;
+    }
+    defaultReal() {
+        const offset = this.bb.__offset(this.bb_pos, 14);
+        return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
+    }
+    mutate_default_real(value) {
+        const offset = this.bb.__offset(this.bb_pos, 14);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeFloat64(this.bb_pos + offset, value);
+        return true;
+    }
+    deprecated() {
+        const offset = this.bb.__offset(this.bb_pos, 16);
+        return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+    }
+    mutate_deprecated(value) {
+        const offset = this.bb.__offset(this.bb_pos, 16);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeInt8(this.bb_pos + offset, +value);
+        return true;
+    }
+    required() {
+        const offset = this.bb.__offset(this.bb_pos, 18);
+        return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+    }
+    mutate_required(value) {
+        const offset = this.bb.__offset(this.bb_pos, 18);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeInt8(this.bb_pos + offset, +value);
+        return true;
+    }
+    key() {
+        const offset = this.bb.__offset(this.bb_pos, 20);
+        return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+    }
+    mutate_key(value) {
+        const offset = this.bb.__offset(this.bb_pos, 20);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeInt8(this.bb_pos + offset, +value);
+        return true;
+    }
+    attributes(index, obj) {
+        const offset = this.bb.__offset(this.bb_pos, 22);
+        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, 22);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    documentation(index, optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 24);
+        return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+    }
+    documentationLength() {
+        const offset = this.bb.__offset(this.bb_pos, 24);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    optional() {
+        const offset = this.bb.__offset(this.bb_pos, 26);
+        return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+    }
+    mutate_optional(value) {
+        const offset = this.bb.__offset(this.bb_pos, 26);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeInt8(this.bb_pos + offset, +value);
+        return true;
+    }
+    /**
+     * Number of padding octets to always add after this field. Structs only.
+     */
+    padding() {
+        const offset = this.bb.__offset(this.bb_pos, 28);
+        return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
+    }
+    mutate_padding(value) {
+        const offset = this.bb.__offset(this.bb_pos, 28);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeUint16(this.bb_pos + offset, value);
+        return true;
+    }
+    static getFullyQualifiedName() {
+        return 'reflection_Field';
+    }
+    static startField(builder) {
+        builder.startObject(13);
+    }
+    static addName(builder, nameOffset) {
+        builder.addFieldOffset(0, nameOffset, 0);
+    }
+    static addType(builder, typeOffset) {
+        builder.addFieldOffset(1, typeOffset, 0);
+    }
+    static addId(builder, id) {
+        builder.addFieldInt16(2, id, 0);
+    }
+    static addOffset(builder, offset) {
+        builder.addFieldInt16(3, offset, 0);
+    }
+    static addDefaultInteger(builder, defaultInteger) {
+        builder.addFieldInt64(4, defaultInteger, BigInt('0'));
+    }
+    static addDefaultReal(builder, defaultReal) {
+        builder.addFieldFloat64(5, defaultReal, 0.0);
+    }
+    static addDeprecated(builder, deprecated) {
+        builder.addFieldInt8(6, +deprecated, +false);
+    }
+    static addRequired(builder, required) {
+        builder.addFieldInt8(7, +required, +false);
+    }
+    static addKey(builder, key) {
+        builder.addFieldInt8(8, +key, +false);
+    }
+    static addAttributes(builder, attributesOffset) {
+        builder.addFieldOffset(9, 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 addDocumentation(builder, documentationOffset) {
+        builder.addFieldOffset(10, documentationOffset, 0);
+    }
+    static createDocumentationVector(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 startDocumentationVector(builder, numElems) {
+        builder.startVector(4, numElems, 4);
+    }
+    static addOptional(builder, optional) {
+        builder.addFieldInt8(11, +optional, +false);
+    }
+    static addPadding(builder, padding) {
+        builder.addFieldInt16(12, padding, 0);
+    }
+    static endField(builder) {
+        const offset = builder.endObject();
+        builder.requiredField(offset, 4); // name
+        builder.requiredField(offset, 6); // type
+        return offset;
+    }
+    unpack() {
+        return new FieldT(this.name(), (this.type() !== null ? this.type().unpack() : null), this.id(), this.offset(), this.defaultInteger(), this.defaultReal(), 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.optional(), this.padding());
+    }
+    unpackTo(_o) {
+        _o.name = this.name();
+        _o.type = (this.type() !== null ? this.type().unpack() : null);
+        _o.id = this.id();
+        _o.offset = this.offset();
+        _o.defaultInteger = this.defaultInteger();
+        _o.defaultReal = this.defaultReal();
+        _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.optional = this.optional();
+        _o.padding = this.padding();
+    }
+}
+export class FieldT {
+    constructor(name = null, type = null, id = 0, offset = 0, defaultInteger = BigInt('0'), defaultReal = 0.0, deprecated = false, required = false, key = false, attributes = [], documentation = [], optional = false, padding = 0) {
+        this.name = name;
+        this.type = type;
+        this.id = id;
+        this.offset = offset;
+        this.defaultInteger = defaultInteger;
+        this.defaultReal = defaultReal;
+        this.deprecated = deprecated;
+        this.required = required;
+        this.key = key;
+        this.attributes = attributes;
+        this.documentation = documentation;
+        this.optional = optional;
+        this.padding = padding;
+    }
+    pack(builder) {
+        const name = (this.name !== null ? builder.createString(this.name) : 0);
+        const type = (this.type !== null ? this.type.pack(builder) : 0);
+        const attributes = Field.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+        const documentation = Field.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+        Field.startField(builder);
+        Field.addName(builder, name);
+        Field.addType(builder, type);
+        Field.addId(builder, this.id);
+        Field.addOffset(builder, this.offset);
+        Field.addDefaultInteger(builder, this.defaultInteger);
+        Field.addDefaultReal(builder, this.defaultReal);
+        Field.addDeprecated(builder, this.deprecated);
+        Field.addRequired(builder, this.required);
+        Field.addKey(builder, this.key);
+        Field.addAttributes(builder, attributes);
+        Field.addDocumentation(builder, documentation);
+        Field.addOptional(builder, this.optional);
+        Field.addPadding(builder, this.padding);
+        return Field.endField(builder);
+    }
+}
diff --git a/tests/ts/reflection/field.ts b/tests/ts/reflection/field.ts
new file mode 100644
index 0000000..48c1bed
--- /dev/null
+++ b/tests/ts/reflection/field.ts
@@ -0,0 +1,377 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { KeyValue, KeyValueT } from '../reflection/key-value.js';
+import { Type, TypeT } from '../reflection/type.js';
+
+
+export class Field {
+  bb: flatbuffers.ByteBuffer|null = null;
+  bb_pos = 0;
+  __init(i:number, bb:flatbuffers.ByteBuffer):Field {
+  this.bb_pos = i;
+  this.bb = bb;
+  return this;
+}
+
+static getRootAsField(bb:flatbuffers.ByteBuffer, obj?:Field):Field {
+  return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsField(bb:flatbuffers.ByteBuffer, obj?:Field):Field {
+  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+  return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+name():string|null
+name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+name(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;
+}
+
+type(obj?:Type):Type|null {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  return offset ? (obj || new Type()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+id():number {
+  const offset = this.bb!.__offset(this.bb_pos, 8);
+  return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+mutate_id(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 8);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeUint16(this.bb_pos + offset, value);
+  return true;
+}
+
+offset():number {
+  const offset = this.bb!.__offset(this.bb_pos, 10);
+  return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+mutate_offset(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 10);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeUint16(this.bb_pos + offset, value);
+  return true;
+}
+
+defaultInteger():bigint {
+  const offset = this.bb!.__offset(this.bb_pos, 12);
+  return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_default_integer(value:bigint):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 12);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeInt64(this.bb_pos + offset, value);
+  return true;
+}
+
+defaultReal():number {
+  const offset = this.bb!.__offset(this.bb_pos, 14);
+  return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
+}
+
+mutate_default_real(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 14);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeFloat64(this.bb_pos + offset, value);
+  return true;
+}
+
+deprecated():boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 16);
+  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_deprecated(value:boolean):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 16);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeInt8(this.bb_pos + offset, +value);
+  return true;
+}
+
+required():boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 18);
+  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_required(value:boolean):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 18);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeInt8(this.bb_pos + offset, +value);
+  return true;
+}
+
+key():boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 20);
+  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_key(value:boolean):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 20);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeInt8(this.bb_pos + offset, +value);
+  return true;
+}
+
+attributes(index: number, obj?:KeyValue):KeyValue|null {
+  const offset = this.bb!.__offset(this.bb_pos, 22);
+  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, 22);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+  const offset = this.bb!.__offset(this.bb_pos, 24);
+  return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 24);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+optional():boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 26);
+  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_optional(value:boolean):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 26);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeInt8(this.bb_pos + offset, +value);
+  return true;
+}
+
+/**
+ * Number of padding octets to always add after this field. Structs only.
+ */
+padding():number {
+  const offset = this.bb!.__offset(this.bb_pos, 28);
+  return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+mutate_padding(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 28);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeUint16(this.bb_pos + offset, value);
+  return true;
+}
+
+static getFullyQualifiedName():string {
+  return 'reflection_Field';
+}
+
+static startField(builder:flatbuffers.Builder) {
+  builder.startObject(13);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addType(builder:flatbuffers.Builder, typeOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(1, typeOffset, 0);
+}
+
+static addId(builder:flatbuffers.Builder, id:number) {
+  builder.addFieldInt16(2, id, 0);
+}
+
+static addOffset(builder:flatbuffers.Builder, offset:number) {
+  builder.addFieldInt16(3, offset, 0);
+}
+
+static addDefaultInteger(builder:flatbuffers.Builder, defaultInteger:bigint) {
+  builder.addFieldInt64(4, defaultInteger, BigInt('0'));
+}
+
+static addDefaultReal(builder:flatbuffers.Builder, defaultReal:number) {
+  builder.addFieldFloat64(5, defaultReal, 0.0);
+}
+
+static addDeprecated(builder:flatbuffers.Builder, deprecated:boolean) {
+  builder.addFieldInt8(6, +deprecated, +false);
+}
+
+static addRequired(builder:flatbuffers.Builder, required:boolean) {
+  builder.addFieldInt8(7, +required, +false);
+}
+
+static addKey(builder:flatbuffers.Builder, key:boolean) {
+  builder.addFieldInt8(8, +key, +false);
+}
+
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(9, 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 addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(10, documentationOffset, 0);
+}
+
+static createDocumentationVector(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 startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+  builder.startVector(4, numElems, 4);
+}
+
+static addOptional(builder:flatbuffers.Builder, optional:boolean) {
+  builder.addFieldInt8(11, +optional, +false);
+}
+
+static addPadding(builder:flatbuffers.Builder, padding:number) {
+  builder.addFieldInt16(12, padding, 0);
+}
+
+static endField(builder:flatbuffers.Builder):flatbuffers.Offset {
+  const offset = builder.endObject();
+  builder.requiredField(offset, 4) // name
+  builder.requiredField(offset, 6) // type
+  return offset;
+}
+
+
+unpack(): FieldT {
+  return new FieldT(
+    this.name(),
+    (this.type() !== null ? this.type()!.unpack() : null),
+    this.id(),
+    this.offset(),
+    this.defaultInteger(),
+    this.defaultReal(),
+    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.optional(),
+    this.padding()
+  );
+}
+
+
+unpackTo(_o: FieldT): void {
+  _o.name = this.name();
+  _o.type = (this.type() !== null ? this.type()!.unpack() : null);
+  _o.id = this.id();
+  _o.offset = this.offset();
+  _o.defaultInteger = this.defaultInteger();
+  _o.defaultReal = this.defaultReal();
+  _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.optional = this.optional();
+  _o.padding = this.padding();
+}
+}
+
+export class FieldT {
+constructor(
+  public name: string|Uint8Array|null = null,
+  public type: TypeT|null = null,
+  public id: number = 0,
+  public offset: number = 0,
+  public defaultInteger: bigint = BigInt('0'),
+  public defaultReal: number = 0.0,
+  public deprecated: boolean = false,
+  public required: boolean = false,
+  public key: boolean = false,
+  public attributes: (KeyValueT)[] = [],
+  public documentation: (string)[] = [],
+  public optional: boolean = false,
+  public padding: number = 0
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+  const name = (this.name !== null ? builder.createString(this.name!) : 0);
+  const type = (this.type !== null ? this.type!.pack(builder) : 0);
+  const attributes = Field.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+  const documentation = Field.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+
+  Field.startField(builder);
+  Field.addName(builder, name);
+  Field.addType(builder, type);
+  Field.addId(builder, this.id);
+  Field.addOffset(builder, this.offset);
+  Field.addDefaultInteger(builder, this.defaultInteger);
+  Field.addDefaultReal(builder, this.defaultReal);
+  Field.addDeprecated(builder, this.deprecated);
+  Field.addRequired(builder, this.required);
+  Field.addKey(builder, this.key);
+  Field.addAttributes(builder, attributes);
+  Field.addDocumentation(builder, documentation);
+  Field.addOptional(builder, this.optional);
+  Field.addPadding(builder, this.padding);
+
+  return Field.endField(builder);
+}
+}
diff --git a/tests/ts/reflection/key-value.js b/tests/ts/reflection/key-value.js
new file mode 100644
index 0000000..622b4f2
--- /dev/null
+++ b/tests/ts/reflection/key-value.js
@@ -0,0 +1,69 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+export class KeyValue {
+    constructor() {
+        this.bb = null;
+        this.bb_pos = 0;
+    }
+    __init(i, bb) {
+        this.bb_pos = i;
+        this.bb = bb;
+        return this;
+    }
+    static getRootAsKeyValue(bb, obj) {
+        return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    static getSizePrefixedRootAsKeyValue(bb, obj) {
+        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+        return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    key(optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 4);
+        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+    }
+    value(optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+    }
+    static getFullyQualifiedName() {
+        return 'reflection_KeyValue';
+    }
+    static startKeyValue(builder) {
+        builder.startObject(2);
+    }
+    static addKey(builder, keyOffset) {
+        builder.addFieldOffset(0, keyOffset, 0);
+    }
+    static addValue(builder, valueOffset) {
+        builder.addFieldOffset(1, valueOffset, 0);
+    }
+    static endKeyValue(builder) {
+        const offset = builder.endObject();
+        builder.requiredField(offset, 4); // key
+        return offset;
+    }
+    static createKeyValue(builder, keyOffset, valueOffset) {
+        KeyValue.startKeyValue(builder);
+        KeyValue.addKey(builder, keyOffset);
+        KeyValue.addValue(builder, valueOffset);
+        return KeyValue.endKeyValue(builder);
+    }
+    unpack() {
+        return new KeyValueT(this.key(), this.value());
+    }
+    unpackTo(_o) {
+        _o.key = this.key();
+        _o.value = this.value();
+    }
+}
+export class KeyValueT {
+    constructor(key = null, value = null) {
+        this.key = key;
+        this.value = value;
+    }
+    pack(builder) {
+        const key = (this.key !== null ? builder.createString(this.key) : 0);
+        const value = (this.value !== null ? builder.createString(this.value) : 0);
+        return KeyValue.createKeyValue(builder, key, value);
+    }
+}
diff --git a/tests/ts/reflection/key-value.ts b/tests/ts/reflection/key-value.ts
new file mode 100644
index 0000000..736766b
--- /dev/null
+++ b/tests/ts/reflection/key-value.ts
@@ -0,0 +1,98 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+export class KeyValue {
+  bb: flatbuffers.ByteBuffer|null = null;
+  bb_pos = 0;
+  __init(i:number, bb:flatbuffers.ByteBuffer):KeyValue {
+  this.bb_pos = i;
+  this.bb = bb;
+  return this;
+}
+
+static getRootAsKeyValue(bb:flatbuffers.ByteBuffer, obj?:KeyValue):KeyValue {
+  return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsKeyValue(bb:flatbuffers.ByteBuffer, obj?:KeyValue):KeyValue {
+  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+  return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+key():string|null
+key(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+key(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;
+}
+
+value():string|null
+value(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+value(optionalEncoding?:any):string|Uint8Array|null {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+static getFullyQualifiedName():string {
+  return 'reflection_KeyValue';
+}
+
+static startKeyValue(builder:flatbuffers.Builder) {
+  builder.startObject(2);
+}
+
+static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(0, keyOffset, 0);
+}
+
+static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(1, valueOffset, 0);
+}
+
+static endKeyValue(builder:flatbuffers.Builder):flatbuffers.Offset {
+  const offset = builder.endObject();
+  builder.requiredField(offset, 4) // key
+  return offset;
+}
+
+static createKeyValue(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset, valueOffset:flatbuffers.Offset):flatbuffers.Offset {
+  KeyValue.startKeyValue(builder);
+  KeyValue.addKey(builder, keyOffset);
+  KeyValue.addValue(builder, valueOffset);
+  return KeyValue.endKeyValue(builder);
+}
+
+unpack(): KeyValueT {
+  return new KeyValueT(
+    this.key(),
+    this.value()
+  );
+}
+
+
+unpackTo(_o: KeyValueT): void {
+  _o.key = this.key();
+  _o.value = this.value();
+}
+}
+
+export class KeyValueT {
+constructor(
+  public key: string|Uint8Array|null = null,
+  public value: string|Uint8Array|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+  const key = (this.key !== null ? builder.createString(this.key!) : 0);
+  const value = (this.value !== null ? builder.createString(this.value!) : 0);
+
+  return KeyValue.createKeyValue(builder,
+    key,
+    value
+  );
+}
+}
diff --git a/tests/ts/reflection/object.js b/tests/ts/reflection/object.js
new file mode 100644
index 0000000..d288545
--- /dev/null
+++ b/tests/ts/reflection/object.js
@@ -0,0 +1,201 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { Field } from '../reflection/field.js';
+import { KeyValue } from '../reflection/key-value.js';
+export class Object_ {
+    constructor() {
+        this.bb = null;
+        this.bb_pos = 0;
+    }
+    __init(i, bb) {
+        this.bb_pos = i;
+        this.bb = bb;
+        return this;
+    }
+    static getRootAsObject(bb, obj) {
+        return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    static getSizePrefixedRootAsObject(bb, obj) {
+        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+        return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    name(optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 4);
+        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+    }
+    fields(index, obj) {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? (obj || new Field()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+    }
+    fieldsLength() {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    isStruct() {
+        const offset = this.bb.__offset(this.bb_pos, 8);
+        return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+    }
+    mutate_is_struct(value) {
+        const offset = this.bb.__offset(this.bb_pos, 8);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeInt8(this.bb_pos + offset, +value);
+        return true;
+    }
+    minalign() {
+        const offset = this.bb.__offset(this.bb_pos, 10);
+        return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+    }
+    mutate_minalign(value) {
+        const offset = this.bb.__offset(this.bb_pos, 10);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeInt32(this.bb_pos + offset, value);
+        return true;
+    }
+    bytesize() {
+        const offset = this.bb.__offset(this.bb_pos, 12);
+        return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+    }
+    mutate_bytesize(value) {
+        const offset = this.bb.__offset(this.bb_pos, 12);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeInt32(this.bb_pos + offset, value);
+        return true;
+    }
+    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;
+    }
+    documentation(index, optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 16);
+        return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+    }
+    documentationLength() {
+        const offset = this.bb.__offset(this.bb_pos, 16);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    declarationFile(optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 18);
+        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+    }
+    static getFullyQualifiedName() {
+        return 'reflection_Object';
+    }
+    static startObject(builder) {
+        builder.startObject(8);
+    }
+    static addName(builder, nameOffset) {
+        builder.addFieldOffset(0, nameOffset, 0);
+    }
+    static addFields(builder, fieldsOffset) {
+        builder.addFieldOffset(1, fieldsOffset, 0);
+    }
+    static createFieldsVector(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 startFieldsVector(builder, numElems) {
+        builder.startVector(4, numElems, 4);
+    }
+    static addIsStruct(builder, isStruct) {
+        builder.addFieldInt8(2, +isStruct, +false);
+    }
+    static addMinalign(builder, minalign) {
+        builder.addFieldInt32(3, minalign, 0);
+    }
+    static addBytesize(builder, bytesize) {
+        builder.addFieldInt32(4, bytesize, 0);
+    }
+    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 addDocumentation(builder, documentationOffset) {
+        builder.addFieldOffset(6, documentationOffset, 0);
+    }
+    static createDocumentationVector(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 startDocumentationVector(builder, numElems) {
+        builder.startVector(4, numElems, 4);
+    }
+    static addDeclarationFile(builder, declarationFileOffset) {
+        builder.addFieldOffset(7, declarationFileOffset, 0);
+    }
+    static endObject(builder) {
+        const offset = builder.endObject();
+        builder.requiredField(offset, 4); // name
+        builder.requiredField(offset, 6); // fields
+        return offset;
+    }
+    static createObject(builder, nameOffset, fieldsOffset, isStruct, minalign, bytesize, attributesOffset, documentationOffset, declarationFileOffset) {
+        Object_.startObject(builder);
+        Object_.addName(builder, nameOffset);
+        Object_.addFields(builder, fieldsOffset);
+        Object_.addIsStruct(builder, isStruct);
+        Object_.addMinalign(builder, minalign);
+        Object_.addBytesize(builder, bytesize);
+        Object_.addAttributes(builder, attributesOffset);
+        Object_.addDocumentation(builder, documentationOffset);
+        Object_.addDeclarationFile(builder, declarationFileOffset);
+        return Object_.endObject(builder);
+    }
+    unpack() {
+        return new Object_T(this.name(), this.bb.createObjList(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.declarationFile());
+    }
+    unpackTo(_o) {
+        _o.name = this.name();
+        _o.fields = this.bb.createObjList(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.declarationFile = this.declarationFile();
+    }
+}
+export class Object_T {
+    constructor(name = null, fields = [], isStruct = false, minalign = 0, bytesize = 0, attributes = [], documentation = [], declarationFile = null) {
+        this.name = name;
+        this.fields = fields;
+        this.isStruct = isStruct;
+        this.minalign = minalign;
+        this.bytesize = bytesize;
+        this.attributes = attributes;
+        this.documentation = documentation;
+        this.declarationFile = declarationFile;
+    }
+    pack(builder) {
+        const name = (this.name !== null ? builder.createString(this.name) : 0);
+        const fields = Object_.createFieldsVector(builder, builder.createObjectOffsetList(this.fields));
+        const attributes = Object_.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+        const documentation = Object_.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+        const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile) : 0);
+        return Object_.createObject(builder, name, fields, this.isStruct, this.minalign, this.bytesize, attributes, documentation, declarationFile);
+    }
+}
diff --git a/tests/ts/reflection/object.ts b/tests/ts/reflection/object.ts
new file mode 100644
index 0000000..1e14f03
--- /dev/null
+++ b/tests/ts/reflection/object.ts
@@ -0,0 +1,277 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { Field, FieldT } from '../reflection/field.js';
+import { KeyValue, KeyValueT } from '../reflection/key-value.js';
+
+
+export class Object_ {
+  bb: flatbuffers.ByteBuffer|null = null;
+  bb_pos = 0;
+  __init(i:number, bb:flatbuffers.ByteBuffer):Object_ {
+  this.bb_pos = i;
+  this.bb = bb;
+  return this;
+}
+
+static getRootAsObject(bb:flatbuffers.ByteBuffer, obj?:Object_):Object_ {
+  return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsObject(bb:flatbuffers.ByteBuffer, obj?:Object_):Object_ {
+  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+  return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+name():string|null
+name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+name(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;
+}
+
+fields(index: number, obj?:Field):Field|null {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  return offset ? (obj || new Field()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+fieldsLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+isStruct():boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 8);
+  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_is_struct(value:boolean):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 8);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeInt8(this.bb_pos + offset, +value);
+  return true;
+}
+
+minalign():number {
+  const offset = this.bb!.__offset(this.bb_pos, 10);
+  return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_minalign(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 10);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeInt32(this.bb_pos + offset, value);
+  return true;
+}
+
+bytesize():number {
+  const offset = this.bb!.__offset(this.bb_pos, 12);
+  return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_bytesize(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 12);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeInt32(this.bb_pos + offset, value);
+  return true;
+}
+
+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;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+  const offset = this.bb!.__offset(this.bb_pos, 16);
+  return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 16);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+/**
+ * File that this Object is declared in.
+ */
+declarationFile():string|null
+declarationFile(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+declarationFile(optionalEncoding?:any):string|Uint8Array|null {
+  const offset = this.bb!.__offset(this.bb_pos, 18);
+  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+static getFullyQualifiedName():string {
+  return 'reflection_Object';
+}
+
+static startObject(builder:flatbuffers.Builder) {
+  builder.startObject(8);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addFields(builder:flatbuffers.Builder, fieldsOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(1, fieldsOffset, 0);
+}
+
+static createFieldsVector(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 startFieldsVector(builder:flatbuffers.Builder, numElems:number) {
+  builder.startVector(4, numElems, 4);
+}
+
+static addIsStruct(builder:flatbuffers.Builder, isStruct:boolean) {
+  builder.addFieldInt8(2, +isStruct, +false);
+}
+
+static addMinalign(builder:flatbuffers.Builder, minalign:number) {
+  builder.addFieldInt32(3, minalign, 0);
+}
+
+static addBytesize(builder:flatbuffers.Builder, bytesize:number) {
+  builder.addFieldInt32(4, bytesize, 0);
+}
+
+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 addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(6, documentationOffset, 0);
+}
+
+static createDocumentationVector(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 startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+  builder.startVector(4, numElems, 4);
+}
+
+static addDeclarationFile(builder:flatbuffers.Builder, declarationFileOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(7, declarationFileOffset, 0);
+}
+
+static endObject(builder:flatbuffers.Builder):flatbuffers.Offset {
+  const offset = builder.endObject();
+  builder.requiredField(offset, 4) // name
+  builder.requiredField(offset, 6) // fields
+  return offset;
+}
+
+static createObject(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, fieldsOffset:flatbuffers.Offset, isStruct:boolean, minalign:number, bytesize:number, attributesOffset:flatbuffers.Offset, documentationOffset:flatbuffers.Offset, declarationFileOffset:flatbuffers.Offset):flatbuffers.Offset {
+  Object_.startObject(builder);
+  Object_.addName(builder, nameOffset);
+  Object_.addFields(builder, fieldsOffset);
+  Object_.addIsStruct(builder, isStruct);
+  Object_.addMinalign(builder, minalign);
+  Object_.addBytesize(builder, bytesize);
+  Object_.addAttributes(builder, attributesOffset);
+  Object_.addDocumentation(builder, documentationOffset);
+  Object_.addDeclarationFile(builder, declarationFileOffset);
+  return Object_.endObject(builder);
+}
+
+unpack(): Object_T {
+  return new Object_T(
+    this.name(),
+    this.bb!.createObjList(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.declarationFile()
+  );
+}
+
+
+unpackTo(_o: Object_T): void {
+  _o.name = this.name();
+  _o.fields = this.bb!.createObjList(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.declarationFile = this.declarationFile();
+}
+}
+
+export class Object_T {
+constructor(
+  public name: string|Uint8Array|null = null,
+  public fields: (FieldT)[] = [],
+  public isStruct: boolean = false,
+  public minalign: number = 0,
+  public bytesize: number = 0,
+  public attributes: (KeyValueT)[] = [],
+  public documentation: (string)[] = [],
+  public declarationFile: string|Uint8Array|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+  const name = (this.name !== null ? builder.createString(this.name!) : 0);
+  const fields = Object_.createFieldsVector(builder, builder.createObjectOffsetList(this.fields));
+  const attributes = Object_.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+  const documentation = Object_.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+  const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile!) : 0);
+
+  return Object_.createObject(builder,
+    name,
+    fields,
+    this.isStruct,
+    this.minalign,
+    this.bytesize,
+    attributes,
+    documentation,
+    declarationFile
+  );
+}
+}
diff --git a/tests/ts/reflection/rpccall.js b/tests/ts/reflection/rpccall.js
new file mode 100644
index 0000000..96e92eb
--- /dev/null
+++ b/tests/ts/reflection/rpccall.js
@@ -0,0 +1,131 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { KeyValue } from '../reflection/key-value.js';
+import { Object_ } from '../reflection/object.js';
+export class RPCCall {
+    constructor() {
+        this.bb = null;
+        this.bb_pos = 0;
+    }
+    __init(i, bb) {
+        this.bb_pos = i;
+        this.bb = bb;
+        return this;
+    }
+    static getRootAsRPCCall(bb, obj) {
+        return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    static getSizePrefixedRootAsRPCCall(bb, obj) {
+        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+        return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    name(optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 4);
+        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+    }
+    request(obj) {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+    }
+    response(obj) {
+        const offset = this.bb.__offset(this.bb_pos, 8);
+        return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+    }
+    attributes(index, obj) {
+        const offset = this.bb.__offset(this.bb_pos, 10);
+        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, 10);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    documentation(index, optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 12);
+        return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+    }
+    documentationLength() {
+        const offset = this.bb.__offset(this.bb_pos, 12);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    static getFullyQualifiedName() {
+        return 'reflection_RPCCall';
+    }
+    static startRPCCall(builder) {
+        builder.startObject(5);
+    }
+    static addName(builder, nameOffset) {
+        builder.addFieldOffset(0, nameOffset, 0);
+    }
+    static addRequest(builder, requestOffset) {
+        builder.addFieldOffset(1, requestOffset, 0);
+    }
+    static addResponse(builder, responseOffset) {
+        builder.addFieldOffset(2, responseOffset, 0);
+    }
+    static addAttributes(builder, attributesOffset) {
+        builder.addFieldOffset(3, 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 addDocumentation(builder, documentationOffset) {
+        builder.addFieldOffset(4, documentationOffset, 0);
+    }
+    static createDocumentationVector(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 startDocumentationVector(builder, numElems) {
+        builder.startVector(4, numElems, 4);
+    }
+    static endRPCCall(builder) {
+        const offset = builder.endObject();
+        builder.requiredField(offset, 4); // name
+        builder.requiredField(offset, 6); // request
+        builder.requiredField(offset, 8); // response
+        return offset;
+    }
+    unpack() {
+        return new RPCCallT(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()));
+    }
+    unpackTo(_o) {
+        _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());
+    }
+}
+export class RPCCallT {
+    constructor(name = null, request = null, response = null, attributes = [], documentation = []) {
+        this.name = name;
+        this.request = request;
+        this.response = response;
+        this.attributes = attributes;
+        this.documentation = documentation;
+    }
+    pack(builder) {
+        const name = (this.name !== null ? builder.createString(this.name) : 0);
+        const request = (this.request !== null ? this.request.pack(builder) : 0);
+        const response = (this.response !== null ? this.response.pack(builder) : 0);
+        const attributes = RPCCall.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+        const documentation = RPCCall.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+        RPCCall.startRPCCall(builder);
+        RPCCall.addName(builder, name);
+        RPCCall.addRequest(builder, request);
+        RPCCall.addResponse(builder, response);
+        RPCCall.addAttributes(builder, attributes);
+        RPCCall.addDocumentation(builder, documentation);
+        return RPCCall.endRPCCall(builder);
+    }
+}
diff --git a/tests/ts/reflection/rpccall.ts b/tests/ts/reflection/rpccall.ts
new file mode 100644
index 0000000..151d7b1
--- /dev/null
+++ b/tests/ts/reflection/rpccall.ts
@@ -0,0 +1,173 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { KeyValue, KeyValueT } from '../reflection/key-value.js';
+import { Object_, Object_T } from '../reflection/object.js';
+
+
+export class RPCCall {
+  bb: flatbuffers.ByteBuffer|null = null;
+  bb_pos = 0;
+  __init(i:number, bb:flatbuffers.ByteBuffer):RPCCall {
+  this.bb_pos = i;
+  this.bb = bb;
+  return this;
+}
+
+static getRootAsRPCCall(bb:flatbuffers.ByteBuffer, obj?:RPCCall):RPCCall {
+  return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsRPCCall(bb:flatbuffers.ByteBuffer, obj?:RPCCall):RPCCall {
+  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+  return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+name():string|null
+name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+name(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;
+}
+
+request(obj?:Object_):Object_|null {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+response(obj?:Object_):Object_|null {
+  const offset = this.bb!.__offset(this.bb_pos, 8);
+  return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+attributes(index: number, obj?:KeyValue):KeyValue|null {
+  const offset = this.bb!.__offset(this.bb_pos, 10);
+  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, 10);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+  const offset = this.bb!.__offset(this.bb_pos, 12);
+  return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 12);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+static getFullyQualifiedName():string {
+  return 'reflection_RPCCall';
+}
+
+static startRPCCall(builder:flatbuffers.Builder) {
+  builder.startObject(5);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addRequest(builder:flatbuffers.Builder, requestOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(1, requestOffset, 0);
+}
+
+static addResponse(builder:flatbuffers.Builder, responseOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(2, responseOffset, 0);
+}
+
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(3, 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 addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(4, documentationOffset, 0);
+}
+
+static createDocumentationVector(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 startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+  builder.startVector(4, numElems, 4);
+}
+
+static endRPCCall(builder:flatbuffers.Builder):flatbuffers.Offset {
+  const offset = builder.endObject();
+  builder.requiredField(offset, 4) // name
+  builder.requiredField(offset, 6) // request
+  builder.requiredField(offset, 8) // response
+  return offset;
+}
+
+
+unpack(): RPCCallT {
+  return new RPCCallT(
+    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())
+  );
+}
+
+
+unpackTo(_o: RPCCallT): void {
+  _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());
+}
+}
+
+export class RPCCallT {
+constructor(
+  public name: string|Uint8Array|null = null,
+  public request: Object_T|null = null,
+  public response: Object_T|null = null,
+  public attributes: (KeyValueT)[] = [],
+  public documentation: (string)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+  const name = (this.name !== null ? builder.createString(this.name!) : 0);
+  const request = (this.request !== null ? this.request!.pack(builder) : 0);
+  const response = (this.response !== null ? this.response!.pack(builder) : 0);
+  const attributes = RPCCall.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+  const documentation = RPCCall.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+
+  RPCCall.startRPCCall(builder);
+  RPCCall.addName(builder, name);
+  RPCCall.addRequest(builder, request);
+  RPCCall.addResponse(builder, response);
+  RPCCall.addAttributes(builder, attributes);
+  RPCCall.addDocumentation(builder, documentation);
+
+  return RPCCall.endRPCCall(builder);
+}
+}
diff --git a/tests/ts/reflection/schema-file.js b/tests/ts/reflection/schema-file.js
new file mode 100644
index 0000000..31c6145
--- /dev/null
+++ b/tests/ts/reflection/schema-file.js
@@ -0,0 +1,88 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+/**
+ * File specific information.
+ * Symbols declared within a file may be recovered by iterating over all
+ * symbols and examining the `declaration_file` field.
+ */
+export class SchemaFile {
+    constructor() {
+        this.bb = null;
+        this.bb_pos = 0;
+    }
+    __init(i, bb) {
+        this.bb_pos = i;
+        this.bb = bb;
+        return this;
+    }
+    static getRootAsSchemaFile(bb, obj) {
+        return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    static getSizePrefixedRootAsSchemaFile(bb, obj) {
+        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+        return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    filename(optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 4);
+        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+    }
+    includedFilenames(index, optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+    }
+    includedFilenamesLength() {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    static getFullyQualifiedName() {
+        return 'reflection_SchemaFile';
+    }
+    static startSchemaFile(builder) {
+        builder.startObject(2);
+    }
+    static addFilename(builder, filenameOffset) {
+        builder.addFieldOffset(0, filenameOffset, 0);
+    }
+    static addIncludedFilenames(builder, includedFilenamesOffset) {
+        builder.addFieldOffset(1, includedFilenamesOffset, 0);
+    }
+    static createIncludedFilenamesVector(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 startIncludedFilenamesVector(builder, numElems) {
+        builder.startVector(4, numElems, 4);
+    }
+    static endSchemaFile(builder) {
+        const offset = builder.endObject();
+        builder.requiredField(offset, 4); // filename
+        return offset;
+    }
+    static createSchemaFile(builder, filenameOffset, includedFilenamesOffset) {
+        SchemaFile.startSchemaFile(builder);
+        SchemaFile.addFilename(builder, filenameOffset);
+        SchemaFile.addIncludedFilenames(builder, includedFilenamesOffset);
+        return SchemaFile.endSchemaFile(builder);
+    }
+    unpack() {
+        return new SchemaFileT(this.filename(), this.bb.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength()));
+    }
+    unpackTo(_o) {
+        _o.filename = this.filename();
+        _o.includedFilenames = this.bb.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength());
+    }
+}
+export class SchemaFileT {
+    constructor(filename = null, includedFilenames = []) {
+        this.filename = filename;
+        this.includedFilenames = includedFilenames;
+    }
+    pack(builder) {
+        const filename = (this.filename !== null ? builder.createString(this.filename) : 0);
+        const includedFilenames = SchemaFile.createIncludedFilenamesVector(builder, builder.createObjectOffsetList(this.includedFilenames));
+        return SchemaFile.createSchemaFile(builder, filename, includedFilenames);
+    }
+}
diff --git a/tests/ts/reflection/schema-file.ts b/tests/ts/reflection/schema-file.ts
new file mode 100644
index 0000000..e1f5035
--- /dev/null
+++ b/tests/ts/reflection/schema-file.ts
@@ -0,0 +1,126 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+/**
+ * File specific information.
+ * Symbols declared within a file may be recovered by iterating over all
+ * symbols and examining the `declaration_file` field.
+ */
+export class SchemaFile {
+  bb: flatbuffers.ByteBuffer|null = null;
+  bb_pos = 0;
+  __init(i:number, bb:flatbuffers.ByteBuffer):SchemaFile {
+  this.bb_pos = i;
+  this.bb = bb;
+  return this;
+}
+
+static getRootAsSchemaFile(bb:flatbuffers.ByteBuffer, obj?:SchemaFile):SchemaFile {
+  return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsSchemaFile(bb:flatbuffers.ByteBuffer, obj?:SchemaFile):SchemaFile {
+  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+  return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+/**
+ * Filename, relative to project root.
+ */
+filename():string|null
+filename(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+filename(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;
+}
+
+/**
+ * Names of included files, relative to project root.
+ */
+includedFilenames(index: number):string
+includedFilenames(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+includedFilenames(index: number,optionalEncoding?:any):string|Uint8Array|null {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+includedFilenamesLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+static getFullyQualifiedName():string {
+  return 'reflection_SchemaFile';
+}
+
+static startSchemaFile(builder:flatbuffers.Builder) {
+  builder.startObject(2);
+}
+
+static addFilename(builder:flatbuffers.Builder, filenameOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(0, filenameOffset, 0);
+}
+
+static addIncludedFilenames(builder:flatbuffers.Builder, includedFilenamesOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(1, includedFilenamesOffset, 0);
+}
+
+static createIncludedFilenamesVector(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 startIncludedFilenamesVector(builder:flatbuffers.Builder, numElems:number) {
+  builder.startVector(4, numElems, 4);
+}
+
+static endSchemaFile(builder:flatbuffers.Builder):flatbuffers.Offset {
+  const offset = builder.endObject();
+  builder.requiredField(offset, 4) // filename
+  return offset;
+}
+
+static createSchemaFile(builder:flatbuffers.Builder, filenameOffset:flatbuffers.Offset, includedFilenamesOffset:flatbuffers.Offset):flatbuffers.Offset {
+  SchemaFile.startSchemaFile(builder);
+  SchemaFile.addFilename(builder, filenameOffset);
+  SchemaFile.addIncludedFilenames(builder, includedFilenamesOffset);
+  return SchemaFile.endSchemaFile(builder);
+}
+
+unpack(): SchemaFileT {
+  return new SchemaFileT(
+    this.filename(),
+    this.bb!.createScalarList(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());
+}
+}
+
+export class SchemaFileT {
+constructor(
+  public filename: string|Uint8Array|null = null,
+  public includedFilenames: (string)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+  const filename = (this.filename !== null ? builder.createString(this.filename!) : 0);
+  const includedFilenames = SchemaFile.createIncludedFilenamesVector(builder, builder.createObjectOffsetList(this.includedFilenames));
+
+  return SchemaFile.createSchemaFile(builder,
+    filename,
+    includedFilenames
+  );
+}
+}
diff --git a/tests/ts/reflection/schema.js b/tests/ts/reflection/schema.js
new file mode 100644
index 0000000..d502297
--- /dev/null
+++ b/tests/ts/reflection/schema.js
@@ -0,0 +1,213 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { Enum } from '../reflection/enum.js';
+import { Object_ } from '../reflection/object.js';
+import { SchemaFile } from '../reflection/schema-file.js';
+import { Service } from '../reflection/service.js';
+export class Schema {
+    constructor() {
+        this.bb = null;
+        this.bb_pos = 0;
+    }
+    __init(i, bb) {
+        this.bb_pos = i;
+        this.bb = bb;
+        return this;
+    }
+    static getRootAsSchema(bb, obj) {
+        return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    static getSizePrefixedRootAsSchema(bb, obj) {
+        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+        return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    static bufferHasIdentifier(bb) {
+        return bb.__has_identifier('BFBS');
+    }
+    objects(index, obj) {
+        const offset = this.bb.__offset(this.bb_pos, 4);
+        return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+    }
+    objectsLength() {
+        const offset = this.bb.__offset(this.bb_pos, 4);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    enums(index, obj) {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? (obj || new Enum()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+    }
+    enumsLength() {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    fileIdent(optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 8);
+        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+    }
+    fileExt(optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 10);
+        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+    }
+    rootTable(obj) {
+        const offset = this.bb.__offset(this.bb_pos, 12);
+        return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+    }
+    services(index, obj) {
+        const offset = this.bb.__offset(this.bb_pos, 14);
+        return offset ? (obj || new Service()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+    }
+    servicesLength() {
+        const offset = this.bb.__offset(this.bb_pos, 14);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    advancedFeatures() {
+        const offset = this.bb.__offset(this.bb_pos, 16);
+        return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
+    }
+    mutate_advanced_features(value) {
+        const offset = this.bb.__offset(this.bb_pos, 16);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeUint64(this.bb_pos + offset, value);
+        return true;
+    }
+    /**
+     * All the files used in this compilation. Files are relative to where
+     * flatc was invoked.
+     */
+    fbsFiles(index, obj) {
+        const offset = this.bb.__offset(this.bb_pos, 18);
+        return offset ? (obj || new SchemaFile()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+    }
+    fbsFilesLength() {
+        const offset = this.bb.__offset(this.bb_pos, 18);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    static getFullyQualifiedName() {
+        return 'reflection_Schema';
+    }
+    static startSchema(builder) {
+        builder.startObject(8);
+    }
+    static addObjects(builder, objectsOffset) {
+        builder.addFieldOffset(0, objectsOffset, 0);
+    }
+    static createObjectsVector(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 startObjectsVector(builder, numElems) {
+        builder.startVector(4, numElems, 4);
+    }
+    static addEnums(builder, enumsOffset) {
+        builder.addFieldOffset(1, enumsOffset, 0);
+    }
+    static createEnumsVector(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 startEnumsVector(builder, numElems) {
+        builder.startVector(4, numElems, 4);
+    }
+    static addFileIdent(builder, fileIdentOffset) {
+        builder.addFieldOffset(2, fileIdentOffset, 0);
+    }
+    static addFileExt(builder, fileExtOffset) {
+        builder.addFieldOffset(3, fileExtOffset, 0);
+    }
+    static addRootTable(builder, rootTableOffset) {
+        builder.addFieldOffset(4, rootTableOffset, 0);
+    }
+    static addServices(builder, servicesOffset) {
+        builder.addFieldOffset(5, servicesOffset, 0);
+    }
+    static createServicesVector(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 startServicesVector(builder, numElems) {
+        builder.startVector(4, numElems, 4);
+    }
+    static addAdvancedFeatures(builder, advancedFeatures) {
+        builder.addFieldInt64(6, advancedFeatures, BigInt('0'));
+    }
+    static addFbsFiles(builder, fbsFilesOffset) {
+        builder.addFieldOffset(7, fbsFilesOffset, 0);
+    }
+    static createFbsFilesVector(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 startFbsFilesVector(builder, numElems) {
+        builder.startVector(4, numElems, 4);
+    }
+    static endSchema(builder) {
+        const offset = builder.endObject();
+        builder.requiredField(offset, 4); // objects
+        builder.requiredField(offset, 6); // enums
+        return offset;
+    }
+    static finishSchemaBuffer(builder, offset) {
+        builder.finish(offset, 'BFBS');
+    }
+    static finishSizePrefixedSchemaBuffer(builder, offset) {
+        builder.finish(offset, 'BFBS', true);
+    }
+    unpack() {
+        return new SchemaT(this.bb.createObjList(this.objects.bind(this), this.objectsLength()), this.bb.createObjList(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.advancedFeatures(), this.bb.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength()));
+    }
+    unpackTo(_o) {
+        _o.objects = this.bb.createObjList(this.objects.bind(this), this.objectsLength());
+        _o.enums = this.bb.createObjList(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.advancedFeatures = this.advancedFeatures();
+        _o.fbsFiles = this.bb.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength());
+    }
+}
+export class SchemaT {
+    constructor(objects = [], enums = [], fileIdent = null, fileExt = null, rootTable = null, services = [], advancedFeatures = BigInt('0'), fbsFiles = []) {
+        this.objects = objects;
+        this.enums = enums;
+        this.fileIdent = fileIdent;
+        this.fileExt = fileExt;
+        this.rootTable = rootTable;
+        this.services = services;
+        this.advancedFeatures = advancedFeatures;
+        this.fbsFiles = fbsFiles;
+    }
+    pack(builder) {
+        const objects = Schema.createObjectsVector(builder, builder.createObjectOffsetList(this.objects));
+        const enums = Schema.createEnumsVector(builder, builder.createObjectOffsetList(this.enums));
+        const fileIdent = (this.fileIdent !== null ? builder.createString(this.fileIdent) : 0);
+        const fileExt = (this.fileExt !== null ? builder.createString(this.fileExt) : 0);
+        const rootTable = (this.rootTable !== null ? this.rootTable.pack(builder) : 0);
+        const services = Schema.createServicesVector(builder, builder.createObjectOffsetList(this.services));
+        const fbsFiles = Schema.createFbsFilesVector(builder, builder.createObjectOffsetList(this.fbsFiles));
+        Schema.startSchema(builder);
+        Schema.addObjects(builder, objects);
+        Schema.addEnums(builder, enums);
+        Schema.addFileIdent(builder, fileIdent);
+        Schema.addFileExt(builder, fileExt);
+        Schema.addRootTable(builder, rootTable);
+        Schema.addServices(builder, services);
+        Schema.addAdvancedFeatures(builder, this.advancedFeatures);
+        Schema.addFbsFiles(builder, fbsFiles);
+        return Schema.endSchema(builder);
+    }
+}
diff --git a/tests/ts/reflection/schema.ts b/tests/ts/reflection/schema.ts
new file mode 100644
index 0000000..d1839c7
--- /dev/null
+++ b/tests/ts/reflection/schema.ts
@@ -0,0 +1,276 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { Enum, EnumT } from '../reflection/enum.js';
+import { Object_, Object_T } from '../reflection/object.js';
+import { SchemaFile, SchemaFileT } from '../reflection/schema-file.js';
+import { Service, ServiceT } from '../reflection/service.js';
+
+
+export class Schema {
+  bb: flatbuffers.ByteBuffer|null = null;
+  bb_pos = 0;
+  __init(i:number, bb:flatbuffers.ByteBuffer):Schema {
+  this.bb_pos = i;
+  this.bb = bb;
+  return this;
+}
+
+static getRootAsSchema(bb:flatbuffers.ByteBuffer, obj?:Schema):Schema {
+  return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsSchema(bb:flatbuffers.ByteBuffer, obj?:Schema):Schema {
+  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+  return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
+  return bb.__has_identifier('BFBS');
+}
+
+objects(index: number, obj?:Object_):Object_|null {
+  const offset = this.bb!.__offset(this.bb_pos, 4);
+  return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+objectsLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 4);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+enums(index: number, obj?:Enum):Enum|null {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  return offset ? (obj || new Enum()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+enumsLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+fileIdent():string|null
+fileIdent(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+fileIdent(optionalEncoding?:any):string|Uint8Array|null {
+  const offset = this.bb!.__offset(this.bb_pos, 8);
+  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+fileExt():string|null
+fileExt(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+fileExt(optionalEncoding?:any):string|Uint8Array|null {
+  const offset = this.bb!.__offset(this.bb_pos, 10);
+  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+rootTable(obj?:Object_):Object_|null {
+  const offset = this.bb!.__offset(this.bb_pos, 12);
+  return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+services(index: number, obj?:Service):Service|null {
+  const offset = this.bb!.__offset(this.bb_pos, 14);
+  return offset ? (obj || new Service()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+servicesLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 14);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+advancedFeatures():bigint {
+  const offset = this.bb!.__offset(this.bb_pos, 16);
+  return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_advanced_features(value:bigint):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 16);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeUint64(this.bb_pos + offset, value);
+  return true;
+}
+
+/**
+ * All the files used in this compilation. Files are relative to where
+ * flatc was invoked.
+ */
+fbsFiles(index: number, obj?:SchemaFile):SchemaFile|null {
+  const offset = this.bb!.__offset(this.bb_pos, 18);
+  return offset ? (obj || new SchemaFile()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+fbsFilesLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 18);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+static getFullyQualifiedName():string {
+  return 'reflection_Schema';
+}
+
+static startSchema(builder:flatbuffers.Builder) {
+  builder.startObject(8);
+}
+
+static addObjects(builder:flatbuffers.Builder, objectsOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(0, objectsOffset, 0);
+}
+
+static createObjectsVector(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 startObjectsVector(builder:flatbuffers.Builder, numElems:number) {
+  builder.startVector(4, numElems, 4);
+}
+
+static addEnums(builder:flatbuffers.Builder, enumsOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(1, enumsOffset, 0);
+}
+
+static createEnumsVector(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 startEnumsVector(builder:flatbuffers.Builder, numElems:number) {
+  builder.startVector(4, numElems, 4);
+}
+
+static addFileIdent(builder:flatbuffers.Builder, fileIdentOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(2, fileIdentOffset, 0);
+}
+
+static addFileExt(builder:flatbuffers.Builder, fileExtOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(3, fileExtOffset, 0);
+}
+
+static addRootTable(builder:flatbuffers.Builder, rootTableOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(4, rootTableOffset, 0);
+}
+
+static addServices(builder:flatbuffers.Builder, servicesOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(5, servicesOffset, 0);
+}
+
+static createServicesVector(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 startServicesVector(builder:flatbuffers.Builder, numElems:number) {
+  builder.startVector(4, numElems, 4);
+}
+
+static addAdvancedFeatures(builder:flatbuffers.Builder, advancedFeatures:bigint) {
+  builder.addFieldInt64(6, advancedFeatures, BigInt('0'));
+}
+
+static addFbsFiles(builder:flatbuffers.Builder, fbsFilesOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(7, fbsFilesOffset, 0);
+}
+
+static createFbsFilesVector(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 startFbsFilesVector(builder:flatbuffers.Builder, numElems:number) {
+  builder.startVector(4, numElems, 4);
+}
+
+static endSchema(builder:flatbuffers.Builder):flatbuffers.Offset {
+  const offset = builder.endObject();
+  builder.requiredField(offset, 4) // objects
+  builder.requiredField(offset, 6) // enums
+  return offset;
+}
+
+static finishSchemaBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+  builder.finish(offset, 'BFBS');
+}
+
+static finishSizePrefixedSchemaBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+  builder.finish(offset, 'BFBS', true);
+}
+
+
+unpack(): SchemaT {
+  return new SchemaT(
+    this.bb!.createObjList(this.objects.bind(this), this.objectsLength()),
+    this.bb!.createObjList(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.advancedFeatures(),
+    this.bb!.createObjList(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.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.advancedFeatures = this.advancedFeatures();
+  _o.fbsFiles = this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength());
+}
+}
+
+export class SchemaT {
+constructor(
+  public objects: (Object_T)[] = [],
+  public enums: (EnumT)[] = [],
+  public fileIdent: string|Uint8Array|null = null,
+  public fileExt: string|Uint8Array|null = null,
+  public rootTable: Object_T|null = null,
+  public services: (ServiceT)[] = [],
+  public advancedFeatures: bigint = BigInt('0'),
+  public fbsFiles: (SchemaFileT)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+  const objects = Schema.createObjectsVector(builder, builder.createObjectOffsetList(this.objects));
+  const enums = Schema.createEnumsVector(builder, builder.createObjectOffsetList(this.enums));
+  const fileIdent = (this.fileIdent !== null ? builder.createString(this.fileIdent!) : 0);
+  const fileExt = (this.fileExt !== null ? builder.createString(this.fileExt!) : 0);
+  const rootTable = (this.rootTable !== null ? this.rootTable!.pack(builder) : 0);
+  const services = Schema.createServicesVector(builder, builder.createObjectOffsetList(this.services));
+  const fbsFiles = Schema.createFbsFilesVector(builder, builder.createObjectOffsetList(this.fbsFiles));
+
+  Schema.startSchema(builder);
+  Schema.addObjects(builder, objects);
+  Schema.addEnums(builder, enums);
+  Schema.addFileIdent(builder, fileIdent);
+  Schema.addFileExt(builder, fileExt);
+  Schema.addRootTable(builder, rootTable);
+  Schema.addServices(builder, services);
+  Schema.addAdvancedFeatures(builder, this.advancedFeatures);
+  Schema.addFbsFiles(builder, fbsFiles);
+
+  return Schema.endSchema(builder);
+}
+}
diff --git a/tests/ts/reflection/service.js b/tests/ts/reflection/service.js
new file mode 100644
index 0000000..8c66ef7
--- /dev/null
+++ b/tests/ts/reflection/service.js
@@ -0,0 +1,146 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { KeyValue } from '../reflection/key-value.js';
+import { RPCCall } from '../reflection/rpccall.js';
+export class Service {
+    constructor() {
+        this.bb = null;
+        this.bb_pos = 0;
+    }
+    __init(i, bb) {
+        this.bb_pos = i;
+        this.bb = bb;
+        return this;
+    }
+    static getRootAsService(bb, obj) {
+        return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    static getSizePrefixedRootAsService(bb, obj) {
+        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+        return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    name(optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 4);
+        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+    }
+    calls(index, obj) {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? (obj || new RPCCall()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+    }
+    callsLength() {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    attributes(index, obj) {
+        const offset = this.bb.__offset(this.bb_pos, 8);
+        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, 8);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    documentation(index, optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 10);
+        return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+    }
+    documentationLength() {
+        const offset = this.bb.__offset(this.bb_pos, 10);
+        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+    }
+    declarationFile(optionalEncoding) {
+        const offset = this.bb.__offset(this.bb_pos, 12);
+        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+    }
+    static getFullyQualifiedName() {
+        return 'reflection_Service';
+    }
+    static startService(builder) {
+        builder.startObject(5);
+    }
+    static addName(builder, nameOffset) {
+        builder.addFieldOffset(0, nameOffset, 0);
+    }
+    static addCalls(builder, callsOffset) {
+        builder.addFieldOffset(1, callsOffset, 0);
+    }
+    static createCallsVector(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 startCallsVector(builder, numElems) {
+        builder.startVector(4, numElems, 4);
+    }
+    static addAttributes(builder, attributesOffset) {
+        builder.addFieldOffset(2, 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 addDocumentation(builder, documentationOffset) {
+        builder.addFieldOffset(3, documentationOffset, 0);
+    }
+    static createDocumentationVector(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 startDocumentationVector(builder, numElems) {
+        builder.startVector(4, numElems, 4);
+    }
+    static addDeclarationFile(builder, declarationFileOffset) {
+        builder.addFieldOffset(4, declarationFileOffset, 0);
+    }
+    static endService(builder) {
+        const offset = builder.endObject();
+        builder.requiredField(offset, 4); // name
+        return offset;
+    }
+    static createService(builder, nameOffset, callsOffset, attributesOffset, documentationOffset, declarationFileOffset) {
+        Service.startService(builder);
+        Service.addName(builder, nameOffset);
+        Service.addCalls(builder, callsOffset);
+        Service.addAttributes(builder, attributesOffset);
+        Service.addDocumentation(builder, documentationOffset);
+        Service.addDeclarationFile(builder, declarationFileOffset);
+        return Service.endService(builder);
+    }
+    unpack() {
+        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.declarationFile());
+    }
+    unpackTo(_o) {
+        _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.declarationFile = this.declarationFile();
+    }
+}
+export class ServiceT {
+    constructor(name = null, calls = [], attributes = [], documentation = [], declarationFile = null) {
+        this.name = name;
+        this.calls = calls;
+        this.attributes = attributes;
+        this.documentation = documentation;
+        this.declarationFile = declarationFile;
+    }
+    pack(builder) {
+        const name = (this.name !== null ? builder.createString(this.name) : 0);
+        const calls = Service.createCallsVector(builder, builder.createObjectOffsetList(this.calls));
+        const attributes = Service.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+        const documentation = Service.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+        const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile) : 0);
+        return Service.createService(builder, name, calls, attributes, documentation, declarationFile);
+    }
+}
diff --git a/tests/ts/reflection/service.ts b/tests/ts/reflection/service.ts
new file mode 100644
index 0000000..c083cae
--- /dev/null
+++ b/tests/ts/reflection/service.ts
@@ -0,0 +1,201 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { KeyValue, KeyValueT } from '../reflection/key-value.js';
+import { RPCCall, RPCCallT } from '../reflection/rpccall.js';
+
+
+export class Service {
+  bb: flatbuffers.ByteBuffer|null = null;
+  bb_pos = 0;
+  __init(i:number, bb:flatbuffers.ByteBuffer):Service {
+  this.bb_pos = i;
+  this.bb = bb;
+  return this;
+}
+
+static getRootAsService(bb:flatbuffers.ByteBuffer, obj?:Service):Service {
+  return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsService(bb:flatbuffers.ByteBuffer, obj?:Service):Service {
+  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+  return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+name():string|null
+name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+name(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;
+}
+
+calls(index: number, obj?:RPCCall):RPCCall|null {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  return offset ? (obj || new RPCCall()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+callsLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  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, 8);
+  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, 8);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+  const offset = this.bb!.__offset(this.bb_pos, 10);
+  return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 10);
+  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+/**
+ * File that this Service is declared in.
+ */
+declarationFile():string|null
+declarationFile(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+declarationFile(optionalEncoding?:any):string|Uint8Array|null {
+  const offset = this.bb!.__offset(this.bb_pos, 12);
+  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+static getFullyQualifiedName():string {
+  return 'reflection_Service';
+}
+
+static startService(builder:flatbuffers.Builder) {
+  builder.startObject(5);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addCalls(builder:flatbuffers.Builder, callsOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(1, callsOffset, 0);
+}
+
+static createCallsVector(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 startCallsVector(builder:flatbuffers.Builder, numElems:number) {
+  builder.startVector(4, numElems, 4);
+}
+
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(2, 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 addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(3, documentationOffset, 0);
+}
+
+static createDocumentationVector(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 startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+  builder.startVector(4, numElems, 4);
+}
+
+static addDeclarationFile(builder:flatbuffers.Builder, declarationFileOffset:flatbuffers.Offset) {
+  builder.addFieldOffset(4, declarationFileOffset, 0);
+}
+
+static endService(builder:flatbuffers.Builder):flatbuffers.Offset {
+  const offset = builder.endObject();
+  builder.requiredField(offset, 4) // name
+  return offset;
+}
+
+static createService(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, callsOffset:flatbuffers.Offset, attributesOffset:flatbuffers.Offset, documentationOffset:flatbuffers.Offset, declarationFileOffset:flatbuffers.Offset):flatbuffers.Offset {
+  Service.startService(builder);
+  Service.addName(builder, nameOffset);
+  Service.addCalls(builder, callsOffset);
+  Service.addAttributes(builder, attributesOffset);
+  Service.addDocumentation(builder, documentationOffset);
+  Service.addDeclarationFile(builder, declarationFileOffset);
+  return Service.endService(builder);
+}
+
+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.declarationFile()
+  );
+}
+
+
+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.declarationFile = this.declarationFile();
+}
+}
+
+export class ServiceT {
+constructor(
+  public name: string|Uint8Array|null = null,
+  public calls: (RPCCallT)[] = [],
+  public attributes: (KeyValueT)[] = [],
+  public documentation: (string)[] = [],
+  public declarationFile: string|Uint8Array|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+  const name = (this.name !== null ? builder.createString(this.name!) : 0);
+  const calls = Service.createCallsVector(builder, builder.createObjectOffsetList(this.calls));
+  const attributes = Service.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+  const documentation = Service.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+  const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile!) : 0);
+
+  return Service.createService(builder,
+    name,
+    calls,
+    attributes,
+    documentation,
+    declarationFile
+  );
+}
+}
diff --git a/tests/ts/reflection/type.js b/tests/ts/reflection/type.js
new file mode 100644
index 0000000..f3ccbdf
--- /dev/null
+++ b/tests/ts/reflection/type.js
@@ -0,0 +1,161 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { BaseType } from '../reflection/base-type.js';
+export class Type {
+    constructor() {
+        this.bb = null;
+        this.bb_pos = 0;
+    }
+    __init(i, bb) {
+        this.bb_pos = i;
+        this.bb = bb;
+        return this;
+    }
+    static getRootAsType(bb, obj) {
+        return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    static getSizePrefixedRootAsType(bb, obj) {
+        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+        return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+    }
+    baseType() {
+        const offset = this.bb.__offset(this.bb_pos, 4);
+        return offset ? this.bb.readInt8(this.bb_pos + offset) : BaseType.None;
+    }
+    mutate_base_type(value) {
+        const offset = this.bb.__offset(this.bb_pos, 4);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeInt8(this.bb_pos + offset, value);
+        return true;
+    }
+    element() {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        return offset ? this.bb.readInt8(this.bb_pos + offset) : BaseType.None;
+    }
+    mutate_element(value) {
+        const offset = this.bb.__offset(this.bb_pos, 6);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeInt8(this.bb_pos + offset, value);
+        return true;
+    }
+    index() {
+        const offset = this.bb.__offset(this.bb_pos, 8);
+        return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
+    }
+    mutate_index(value) {
+        const offset = this.bb.__offset(this.bb_pos, 8);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeInt32(this.bb_pos + offset, value);
+        return true;
+    }
+    fixedLength() {
+        const offset = this.bb.__offset(this.bb_pos, 10);
+        return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
+    }
+    mutate_fixed_length(value) {
+        const offset = this.bb.__offset(this.bb_pos, 10);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeUint16(this.bb_pos + offset, value);
+        return true;
+    }
+    /**
+     * The size (octets) of the `base_type` field.
+     */
+    baseSize() {
+        const offset = this.bb.__offset(this.bb_pos, 12);
+        return offset ? this.bb.readUint32(this.bb_pos + offset) : 4;
+    }
+    mutate_base_size(value) {
+        const offset = this.bb.__offset(this.bb_pos, 12);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeUint32(this.bb_pos + offset, value);
+        return true;
+    }
+    /**
+     * The size (octets) of the `element` field, if present.
+     */
+    elementSize() {
+        const offset = this.bb.__offset(this.bb_pos, 14);
+        return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
+    }
+    mutate_element_size(value) {
+        const offset = this.bb.__offset(this.bb_pos, 14);
+        if (offset === 0) {
+            return false;
+        }
+        this.bb.writeUint32(this.bb_pos + offset, value);
+        return true;
+    }
+    static getFullyQualifiedName() {
+        return 'reflection_Type';
+    }
+    static startType(builder) {
+        builder.startObject(6);
+    }
+    static addBaseType(builder, baseType) {
+        builder.addFieldInt8(0, baseType, BaseType.None);
+    }
+    static addElement(builder, element) {
+        builder.addFieldInt8(1, element, BaseType.None);
+    }
+    static addIndex(builder, index) {
+        builder.addFieldInt32(2, index, -1);
+    }
+    static addFixedLength(builder, fixedLength) {
+        builder.addFieldInt16(3, fixedLength, 0);
+    }
+    static addBaseSize(builder, baseSize) {
+        builder.addFieldInt32(4, baseSize, 4);
+    }
+    static addElementSize(builder, elementSize) {
+        builder.addFieldInt32(5, elementSize, 0);
+    }
+    static endType(builder) {
+        const offset = builder.endObject();
+        return offset;
+    }
+    static createType(builder, baseType, element, index, fixedLength, baseSize, elementSize) {
+        Type.startType(builder);
+        Type.addBaseType(builder, baseType);
+        Type.addElement(builder, element);
+        Type.addIndex(builder, index);
+        Type.addFixedLength(builder, fixedLength);
+        Type.addBaseSize(builder, baseSize);
+        Type.addElementSize(builder, elementSize);
+        return Type.endType(builder);
+    }
+    unpack() {
+        return new TypeT(this.baseType(), this.element(), this.index(), this.fixedLength(), this.baseSize(), this.elementSize());
+    }
+    unpackTo(_o) {
+        _o.baseType = this.baseType();
+        _o.element = this.element();
+        _o.index = this.index();
+        _o.fixedLength = this.fixedLength();
+        _o.baseSize = this.baseSize();
+        _o.elementSize = this.elementSize();
+    }
+}
+export class TypeT {
+    constructor(baseType = BaseType.None, element = BaseType.None, index = -1, fixedLength = 0, baseSize = 4, elementSize = 0) {
+        this.baseType = baseType;
+        this.element = element;
+        this.index = index;
+        this.fixedLength = fixedLength;
+        this.baseSize = baseSize;
+        this.elementSize = elementSize;
+    }
+    pack(builder) {
+        return Type.createType(builder, this.baseType, this.element, this.index, this.fixedLength, this.baseSize, this.elementSize);
+    }
+}
diff --git a/tests/ts/reflection/type.ts b/tests/ts/reflection/type.ts
new file mode 100644
index 0000000..e831e21
--- /dev/null
+++ b/tests/ts/reflection/type.ts
@@ -0,0 +1,219 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { BaseType } from '../reflection/base-type.js';
+
+
+export class Type {
+  bb: flatbuffers.ByteBuffer|null = null;
+  bb_pos = 0;
+  __init(i:number, bb:flatbuffers.ByteBuffer):Type {
+  this.bb_pos = i;
+  this.bb = bb;
+  return this;
+}
+
+static getRootAsType(bb:flatbuffers.ByteBuffer, obj?:Type):Type {
+  return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsType(bb:flatbuffers.ByteBuffer, obj?:Type):Type {
+  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+  return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+baseType():BaseType {
+  const offset = this.bb!.__offset(this.bb_pos, 4);
+  return offset ? this.bb!.readInt8(this.bb_pos + offset) : BaseType.None;
+}
+
+mutate_base_type(value:BaseType):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 4);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeInt8(this.bb_pos + offset, value);
+  return true;
+}
+
+element():BaseType {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+  return offset ? this.bb!.readInt8(this.bb_pos + offset) : BaseType.None;
+}
+
+mutate_element(value:BaseType):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 6);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeInt8(this.bb_pos + offset, value);
+  return true;
+}
+
+index():number {
+  const offset = this.bb!.__offset(this.bb_pos, 8);
+  return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
+}
+
+mutate_index(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 8);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeInt32(this.bb_pos + offset, value);
+  return true;
+}
+
+fixedLength():number {
+  const offset = this.bb!.__offset(this.bb_pos, 10);
+  return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+mutate_fixed_length(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 10);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeUint16(this.bb_pos + offset, value);
+  return true;
+}
+
+/**
+ * The size (octets) of the `base_type` field.
+ */
+baseSize():number {
+  const offset = this.bb!.__offset(this.bb_pos, 12);
+  return offset ? this.bb!.readUint32(this.bb_pos + offset) : 4;
+}
+
+mutate_base_size(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 12);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeUint32(this.bb_pos + offset, value);
+  return true;
+}
+
+/**
+ * The size (octets) of the `element` field, if present.
+ */
+elementSize():number {
+  const offset = this.bb!.__offset(this.bb_pos, 14);
+  return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
+}
+
+mutate_element_size(value:number):boolean {
+  const offset = this.bb!.__offset(this.bb_pos, 14);
+
+  if (offset === 0) {
+    return false;
+  }
+
+  this.bb!.writeUint32(this.bb_pos + offset, value);
+  return true;
+}
+
+static getFullyQualifiedName():string {
+  return 'reflection_Type';
+}
+
+static startType(builder:flatbuffers.Builder) {
+  builder.startObject(6);
+}
+
+static addBaseType(builder:flatbuffers.Builder, baseType:BaseType) {
+  builder.addFieldInt8(0, baseType, BaseType.None);
+}
+
+static addElement(builder:flatbuffers.Builder, element:BaseType) {
+  builder.addFieldInt8(1, element, BaseType.None);
+}
+
+static addIndex(builder:flatbuffers.Builder, index:number) {
+  builder.addFieldInt32(2, index, -1);
+}
+
+static addFixedLength(builder:flatbuffers.Builder, fixedLength:number) {
+  builder.addFieldInt16(3, fixedLength, 0);
+}
+
+static addBaseSize(builder:flatbuffers.Builder, baseSize:number) {
+  builder.addFieldInt32(4, baseSize, 4);
+}
+
+static addElementSize(builder:flatbuffers.Builder, elementSize:number) {
+  builder.addFieldInt32(5, elementSize, 0);
+}
+
+static endType(builder:flatbuffers.Builder):flatbuffers.Offset {
+  const offset = builder.endObject();
+  return offset;
+}
+
+static createType(builder:flatbuffers.Builder, baseType:BaseType, element:BaseType, index:number, fixedLength:number, baseSize:number, elementSize:number):flatbuffers.Offset {
+  Type.startType(builder);
+  Type.addBaseType(builder, baseType);
+  Type.addElement(builder, element);
+  Type.addIndex(builder, index);
+  Type.addFixedLength(builder, fixedLength);
+  Type.addBaseSize(builder, baseSize);
+  Type.addElementSize(builder, elementSize);
+  return Type.endType(builder);
+}
+
+unpack(): TypeT {
+  return new TypeT(
+    this.baseType(),
+    this.element(),
+    this.index(),
+    this.fixedLength(),
+    this.baseSize(),
+    this.elementSize()
+  );
+}
+
+
+unpackTo(_o: TypeT): void {
+  _o.baseType = this.baseType();
+  _o.element = this.element();
+  _o.index = this.index();
+  _o.fixedLength = this.fixedLength();
+  _o.baseSize = this.baseSize();
+  _o.elementSize = this.elementSize();
+}
+}
+
+export class TypeT {
+constructor(
+  public baseType: BaseType = BaseType.None,
+  public element: BaseType = BaseType.None,
+  public index: number = -1,
+  public fixedLength: number = 0,
+  public baseSize: number = 4,
+  public elementSize: number = 0
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+  return Type.createType(builder,
+    this.baseType,
+    this.element,
+    this.index,
+    this.fixedLength,
+    this.baseSize,
+    this.elementSize
+  );
+}
+}