From 425c3638f995db264fc83787adbfb6f77dbc5cd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Harrtell?= Date: Mon, 21 Aug 2023 22:57:59 +0200 Subject: [PATCH] TS: Add missing generate files --- .../arrays_test_complex_generated.cjs | 6 +- .../ts/arrays_test_complex/my-game/example.js | 1 + .../ts/arrays_test_complex/my-game/example.ts | 2 + .../my-game/example/array-struct.ts | 2 + .../my-game/example/array-table.js | 1 + .../my-game/example/array-table.ts | 2 + .../my-game/example/inner-struct.ts | 2 + .../my-game/example/nested-struct.ts | 2 + .../my-game/example/outer-struct.ts | 2 + .../my-game/example/test-enum.js | 3 +- .../my-game/example/test-enum.ts | 2 + tests/ts/foobar.js | 1 + tests/ts/foobar.ts | 2 + tests/ts/foobar/abc.js | 3 +- tests/ts/foobar/abc.ts | 2 + tests/ts/foobar/class.js | 3 +- tests/ts/foobar/class.ts | 2 + tests/ts/foobar/tab.ts | 2 + tests/ts/monster_test.js | 1 + tests/ts/monster_test_generated.cjs | 146 ++++++------- tests/ts/my-game.js | 1 + tests/ts/my-game/example.js | 1 + .../my-game/example/any-ambiguous-aliases.js | 3 +- .../ts/my-game/example/any-unique-aliases.js | 3 +- tests/ts/my-game/example/any.js | 3 +- tests/ts/my-game/example/color.js | 3 +- tests/ts/my-game/example/long-enum.js | 3 +- tests/ts/my-game/example/monster.js | 1 + tests/ts/my-game/example/race.js | 3 +- tests/ts/my-game/example/referrable.js | 1 + tests/ts/my-game/example/stat.js | 1 + .../example/test-simple-table-with-enum.js | 1 + tests/ts/my-game/example/type-aliases.js | 1 + tests/ts/my-game/example2.js | 1 + tests/ts/my-game/example2/monster.js | 1 + tests/ts/my-game/in-parent-namespace.js | 1 + tests/ts/my-game/other-name-space.js | 1 + .../my-game/other-name-space/from-include.js | 3 +- .../my-game/other-name-space/from-include.ts | 2 + tests/ts/my-game/other-name-space/table-b.js | 1 + tests/ts/my-game/other-name-space/table-b.ts | 2 + tests/ts/my-game/other-name-space/unused.ts | 2 + tests/ts/no_import_ext/optional-scalars.ts | 2 + .../optional-scalars/optional-byte.ts | 2 + .../optional-scalars/scalar-stuff.ts | 2 + tests/ts/no_import_ext/optional_scalars.ts | 2 + tests/ts/reflection.js | 1 + tests/ts/reflection.ts | 2 + tests/ts/reflection/advanced-features.js | 3 +- tests/ts/reflection/advanced-features.ts | 2 + tests/ts/reflection/base-type.d.ts | 3 +- tests/ts/reflection/base-type.js | 6 +- tests/ts/reflection/base-type.ts | 5 +- tests/ts/reflection/enum-val.js | 1 + tests/ts/reflection/enum-val.ts | 2 + tests/ts/reflection/enum.js | 1 + tests/ts/reflection/enum.ts | 2 + tests/ts/reflection/field.d.ts | 9 +- tests/ts/reflection/field.js | 28 ++- tests/ts/reflection/field.ts | 35 +++- tests/ts/reflection/key-value.js | 1 + tests/ts/reflection/key-value.ts | 2 + tests/ts/reflection/object.js | 1 + tests/ts/reflection/object.ts | 2 + tests/ts/reflection/rpccall.js | 1 + tests/ts/reflection/rpccall.ts | 2 + tests/ts/reflection/schema-file.js | 1 + tests/ts/reflection/schema-file.ts | 2 + tests/ts/reflection/schema.js | 1 + tests/ts/reflection/schema.ts | 2 + tests/ts/reflection/service.js | 1 + tests/ts/reflection/service.ts | 2 + tests/ts/reflection/type.js | 1 + tests/ts/reflection/type.ts | 2 + tests/ts/table-a.js | 1 + tests/ts/table-a.ts | 2 + tests/ts/typescript.js | 1 + tests/ts/typescript.ts | 2 + tests/ts/typescript/class.js | 3 +- tests/ts/typescript/class.ts | 2 + tests/ts/typescript/object.js | 1 + tests/ts/typescript/object.ts | 2 + tests/ts/typescript_include.ts | 2 + tests/ts/typescript_keywords.js | 1 + tests/ts/typescript_keywords.ts | 2 + tests/ts/typescript_keywords_generated.cjs | 132 ++++++------ tests/ts/typescript_transitive_include.ts | 2 + tests/ts/union-underlying-type.d.ts | 5 + tests/ts/union-underlying-type.js | 7 + tests/ts/union-underlying-type.ts | 9 + tests/ts/union-underlying-type/a.d.ts | 22 ++ tests/ts/union-underlying-type/a.js | 65 ++++++ tests/ts/union-underlying-type/a.ts | 89 ++++++++ tests/ts/union-underlying-type/abc.d.ts | 11 + tests/ts/union-underlying-type/abc.js | 30 +++ tests/ts/union-underlying-type/abc.ts | 42 ++++ tests/ts/union-underlying-type/b.d.ts | 22 ++ tests/ts/union-underlying-type/b.js | 58 ++++++ tests/ts/union-underlying-type/b.ts | 82 ++++++++ tests/ts/union-underlying-type/c.d.ts | 22 ++ tests/ts/union-underlying-type/c.js | 65 ++++++ tests/ts/union-underlying-type/c.ts | 89 ++++++++ tests/ts/union-underlying-type/d.d.ts | 41 ++++ tests/ts/union-underlying-type/d.js | 163 +++++++++++++++ tests/ts/union-underlying-type/d.ts | 197 ++++++++++++++++++ tests/ts/union_underlying_type_test.d.ts | 1 + tests/ts/union_underlying_type_test.js | 3 + tests/ts/union_underlying_type_test.ts | 5 + tests/ts/union_vector/attacker.js | 1 + tests/ts/union_vector/character.js | 3 +- tests/ts/union_vector/gadget.js | 3 +- tests/ts/union_vector/hand-fan.js | 1 + tests/ts/union_vector/movie.js | 1 + tests/ts/union_vector/union_vector.js | 1 + .../union_vector/union_vector_generated.cjs | 42 ++-- 115 files changed, 1400 insertions(+), 188 deletions(-) create mode 100644 tests/ts/union-underlying-type.d.ts create mode 100644 tests/ts/union-underlying-type.js create mode 100644 tests/ts/union-underlying-type.ts create mode 100644 tests/ts/union-underlying-type/a.d.ts create mode 100644 tests/ts/union-underlying-type/a.js create mode 100644 tests/ts/union-underlying-type/a.ts create mode 100644 tests/ts/union-underlying-type/abc.d.ts create mode 100644 tests/ts/union-underlying-type/abc.js create mode 100644 tests/ts/union-underlying-type/abc.ts create mode 100644 tests/ts/union-underlying-type/b.d.ts create mode 100644 tests/ts/union-underlying-type/b.js create mode 100644 tests/ts/union-underlying-type/b.ts create mode 100644 tests/ts/union-underlying-type/c.d.ts create mode 100644 tests/ts/union-underlying-type/c.js create mode 100644 tests/ts/union-underlying-type/c.ts create mode 100644 tests/ts/union-underlying-type/d.d.ts create mode 100644 tests/ts/union-underlying-type/d.js create mode 100644 tests/ts/union-underlying-type/d.ts create mode 100644 tests/ts/union_underlying_type_test.d.ts create mode 100644 tests/ts/union_underlying_type_test.js create mode 100644 tests/ts/union_underlying_type_test.ts diff --git a/tests/ts/arrays_test_complex/arrays_test_complex_generated.cjs b/tests/ts/arrays_test_complex/arrays_test_complex_generated.cjs index ec2df6334ef..c54e622f9be 100644 --- a/tests/ts/arrays_test_complex/arrays_test_complex_generated.cjs +++ b/tests/ts/arrays_test_complex/arrays_test_complex_generated.cjs @@ -387,7 +387,7 @@ var ArrayStructT = class { // arrays_test_complex/my-game/example/array-table.js var flatbuffers = __toESM(require("flatbuffers"), 1); -var ArrayTable = class { +var ArrayTable = class _ArrayTable { constructor() { this.bb = null; this.bb_pos = 0; @@ -398,11 +398,11 @@ var ArrayTable = class { return this; } static getRootAsArrayTable(bb, obj) { - return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsArrayTable(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static bufferHasIdentifier(bb) { return bb.__has_identifier("RHUB"); diff --git a/tests/ts/arrays_test_complex/my-game/example.js b/tests/ts/arrays_test_complex/my-game/example.js index 78d5ab6944e..d9405e14236 100644 --- a/tests/ts/arrays_test_complex/my-game/example.js +++ b/tests/ts/arrays_test_complex/my-game/example.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export { ArrayStruct, ArrayStructT } from './example/array-struct.js'; export { ArrayTable, ArrayTableT } from './example/array-table.js'; export { InnerStruct, InnerStructT } from './example/inner-struct.js'; diff --git a/tests/ts/arrays_test_complex/my-game/example.ts b/tests/ts/arrays_test_complex/my-game/example.ts index da121608513..4f1d63b4e20 100644 --- a/tests/ts/arrays_test_complex/my-game/example.ts +++ b/tests/ts/arrays_test_complex/my-game/example.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export { ArrayStruct, ArrayStructT } from './example/array-struct.js'; export { ArrayTable, ArrayTableT } from './example/array-table.js'; export { InnerStruct, InnerStructT } from './example/inner-struct.js'; diff --git a/tests/ts/arrays_test_complex/my-game/example/array-struct.ts b/tests/ts/arrays_test_complex/my-game/example/array-struct.ts index eb81e05d475..6d542448c9b 100644 --- a/tests/ts/arrays_test_complex/my-game/example/array-struct.ts +++ b/tests/ts/arrays_test_complex/my-game/example/array-struct.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { NestedStruct, NestedStructT } from '../../my-game/example/nested-struct.js'; diff --git a/tests/ts/arrays_test_complex/my-game/example/array-table.js b/tests/ts/arrays_test_complex/my-game/example/array-table.js index b171023b1f3..9dc6ffdeb24 100644 --- a/tests/ts/arrays_test_complex/my-game/example/array-table.js +++ b/tests/ts/arrays_test_complex/my-game/example/array-table.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { ArrayStruct } from '../../my-game/example/array-struct.js'; export class ArrayTable { diff --git a/tests/ts/arrays_test_complex/my-game/example/array-table.ts b/tests/ts/arrays_test_complex/my-game/example/array-table.ts index b744aa3e177..ef94eaad9b5 100644 --- a/tests/ts/arrays_test_complex/my-game/example/array-table.ts +++ b/tests/ts/arrays_test_complex/my-game/example/array-table.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { ArrayStruct, ArrayStructT } from '../../my-game/example/array-struct.js'; diff --git a/tests/ts/arrays_test_complex/my-game/example/inner-struct.ts b/tests/ts/arrays_test_complex/my-game/example/inner-struct.ts index 4ebaafba2a1..cff7a58432d 100644 --- a/tests/ts/arrays_test_complex/my-game/example/inner-struct.ts +++ b/tests/ts/arrays_test_complex/my-game/example/inner-struct.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; diff --git a/tests/ts/arrays_test_complex/my-game/example/nested-struct.ts b/tests/ts/arrays_test_complex/my-game/example/nested-struct.ts index 39e62600de7..3e9891887f6 100644 --- a/tests/ts/arrays_test_complex/my-game/example/nested-struct.ts +++ b/tests/ts/arrays_test_complex/my-game/example/nested-struct.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js'; diff --git a/tests/ts/arrays_test_complex/my-game/example/outer-struct.ts b/tests/ts/arrays_test_complex/my-game/example/outer-struct.ts index 50fb64b63a5..39fc0a72703 100644 --- a/tests/ts/arrays_test_complex/my-game/example/outer-struct.ts +++ b/tests/ts/arrays_test_complex/my-game/example/outer-struct.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { InnerStruct, InnerStructT } from '../../my-game/example/inner-struct.js'; diff --git a/tests/ts/arrays_test_complex/my-game/example/test-enum.js b/tests/ts/arrays_test_complex/my-game/example/test-enum.js index 1fb1550535c..abe18369f63 100644 --- a/tests/ts/arrays_test_complex/my-game/example/test-enum.js +++ b/tests/ts/arrays_test_complex/my-game/example/test-enum.js @@ -1,7 +1,8 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export var TestEnum; (function (TestEnum) { TestEnum[TestEnum["A"] = 0] = "A"; TestEnum[TestEnum["B"] = 1] = "B"; TestEnum[TestEnum["C"] = 2] = "C"; -})(TestEnum = TestEnum || (TestEnum = {})); +})(TestEnum || (TestEnum = {})); diff --git a/tests/ts/arrays_test_complex/my-game/example/test-enum.ts b/tests/ts/arrays_test_complex/my-game/example/test-enum.ts index a450fc82a74..d07713911c1 100644 --- a/tests/ts/arrays_test_complex/my-game/example/test-enum.ts +++ b/tests/ts/arrays_test_complex/my-game/example/test-enum.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export enum TestEnum { A = 0, B = 1, diff --git a/tests/ts/foobar.js b/tests/ts/foobar.js index 6a84acc5e14..fa5fd6dbf3b 100644 --- a/tests/ts/foobar.js +++ b/tests/ts/foobar.js @@ -1,2 +1,3 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export { Abc } from './foobar/abc.js'; diff --git a/tests/ts/foobar.ts b/tests/ts/foobar.ts index 067b4860ee5..e513600c603 100644 --- a/tests/ts/foobar.ts +++ b/tests/ts/foobar.ts @@ -1,3 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export { Abc } from './foobar/abc.js'; diff --git a/tests/ts/foobar/abc.js b/tests/ts/foobar/abc.js index 40f0d7a2b4e..8c3aeb95286 100644 --- a/tests/ts/foobar/abc.js +++ b/tests/ts/foobar/abc.js @@ -1,5 +1,6 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export var Abc; (function (Abc) { Abc[Abc["a"] = 0] = "a"; -})(Abc = Abc || (Abc = {})); +})(Abc || (Abc = {})); diff --git a/tests/ts/foobar/abc.ts b/tests/ts/foobar/abc.ts index ef8842b22b5..308713cc642 100644 --- a/tests/ts/foobar/abc.ts +++ b/tests/ts/foobar/abc.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export enum Abc { a = 0 } diff --git a/tests/ts/foobar/class.js b/tests/ts/foobar/class.js index d278ac94638..179ab6f0435 100644 --- a/tests/ts/foobar/class.js +++ b/tests/ts/foobar/class.js @@ -1,5 +1,6 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export var class_; (function (class_) { class_[class_["arguments_"] = 0] = "arguments_"; -})(class_ = class_ || (class_ = {})); +})(class_ || (class_ = {})); diff --git a/tests/ts/foobar/class.ts b/tests/ts/foobar/class.ts index d26fb287943..db45d22ca45 100644 --- a/tests/ts/foobar/class.ts +++ b/tests/ts/foobar/class.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export enum class_ { arguments_ = 0 } diff --git a/tests/ts/foobar/tab.ts b/tests/ts/foobar/tab.ts index a15ada717cb..3af76d91da4 100644 --- a/tests/ts/foobar/tab.ts +++ b/tests/ts/foobar/tab.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { Abc } from '../foobar/abc.js'; diff --git a/tests/ts/monster_test.js b/tests/ts/monster_test.js index a378544c260..04d21753c1f 100644 --- a/tests/ts/monster_test.js +++ b/tests/ts/monster_test.js @@ -1,3 +1,4 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export { TableA, TableAT } from './table-a.js'; export * as MyGame from './my-game.js'; diff --git a/tests/ts/monster_test_generated.cjs b/tests/ts/monster_test_generated.cjs index 234054b9e73..2ba0a4a6939 100644 --- a/tests/ts/monster_test_generated.cjs +++ b/tests/ts/monster_test_generated.cjs @@ -41,7 +41,7 @@ var flatbuffers2 = __toESM(require("flatbuffers"), 1); // my-game/other-name-space/table-b.js var flatbuffers = __toESM(require("flatbuffers"), 1); -var TableB = class { +var TableB = class _TableB { constructor() { this.bb = null; this.bb_pos = 0; @@ -52,11 +52,11 @@ var TableB = class { return this; } static getRootAsTableB(bb, obj) { - return (obj || new TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsTableB(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } a(obj) { const offset = this.bb.__offset(this.bb_pos, 4); @@ -76,15 +76,15 @@ var TableB = class { return offset; } static createTableB(builder, aOffset) { - TableB.startTableB(builder); - TableB.addA(builder, aOffset); - return TableB.endTableB(builder); + _TableB.startTableB(builder); + _TableB.addA(builder, aOffset); + return _TableB.endTableB(builder); } serialize() { return this.bb.bytes(); } static deserialize(buffer) { - return TableB.getRootAsTableB(new flatbuffers.ByteBuffer(buffer)); + return _TableB.getRootAsTableB(new flatbuffers.ByteBuffer(buffer)); } unpack() { return new TableBT(this.a() !== null ? this.a().unpack() : null); @@ -104,7 +104,7 @@ var TableBT = class { }; // table-a.js -var TableA = class { +var TableA = class _TableA { constructor() { this.bb = null; this.bb_pos = 0; @@ -115,11 +115,11 @@ var TableA = class { return this; } static getRootAsTableA(bb, obj) { - return (obj || new TableA()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _TableA()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsTableA(bb, obj) { bb.setPosition(bb.position() + flatbuffers2.SIZE_PREFIX_LENGTH); - return (obj || new TableA()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _TableA()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } b(obj) { const offset = this.bb.__offset(this.bb_pos, 4); @@ -139,15 +139,15 @@ var TableA = class { return offset; } static createTableA(builder, bOffset) { - TableA.startTableA(builder); - TableA.addB(builder, bOffset); - return TableA.endTableA(builder); + _TableA.startTableA(builder); + _TableA.addB(builder, bOffset); + return _TableA.endTableA(builder); } serialize() { return this.bb.bytes(); } static deserialize(buffer) { - return TableA.getRootAsTableA(new flatbuffers2.ByteBuffer(buffer)); + return _TableA.getRootAsTableA(new flatbuffers2.ByteBuffer(buffer)); } unpack() { return new TableAT(this.b() !== null ? this.b().unpack() : null); @@ -178,7 +178,7 @@ __export(my_game_exports, { // my-game/in-parent-namespace.js var flatbuffers3 = __toESM(require("flatbuffers"), 1); -var InParentNamespace = class { +var InParentNamespace = class _InParentNamespace { constructor() { this.bb = null; this.bb_pos = 0; @@ -189,11 +189,11 @@ var InParentNamespace = class { return this; } static getRootAsInParentNamespace(bb, obj) { - return (obj || new InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsInParentNamespace(bb, obj) { bb.setPosition(bb.position() + flatbuffers3.SIZE_PREFIX_LENGTH); - return (obj || new InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getFullyQualifiedName() { return "MyGame.InParentNamespace"; @@ -206,14 +206,14 @@ var InParentNamespace = class { return offset; } static createInParentNamespace(builder) { - InParentNamespace.startInParentNamespace(builder); - return InParentNamespace.endInParentNamespace(builder); + _InParentNamespace.startInParentNamespace(builder); + return _InParentNamespace.endInParentNamespace(builder); } serialize() { return this.bb.bytes(); } static deserialize(buffer) { - return InParentNamespace.getRootAsInParentNamespace(new flatbuffers3.ByteBuffer(buffer)); + return _InParentNamespace.getRootAsInParentNamespace(new flatbuffers3.ByteBuffer(buffer)); } unpack() { return new InParentNamespaceT(); @@ -317,7 +317,7 @@ var AbilityT = class { // my-game/example2/monster.js var flatbuffers4 = __toESM(require("flatbuffers"), 1); -var Monster = class { +var Monster = class _Monster { constructor() { this.bb = null; this.bb_pos = 0; @@ -328,11 +328,11 @@ var Monster = class { return this; } static getRootAsMonster(bb, obj) { - return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsMonster(bb, obj) { bb.setPosition(bb.position() + flatbuffers4.SIZE_PREFIX_LENGTH); - return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getFullyQualifiedName() { return "MyGame.Example2.Monster"; @@ -345,14 +345,14 @@ var Monster = class { return offset; } static createMonster(builder) { - Monster.startMonster(builder); - return Monster.endMonster(builder); + _Monster.startMonster(builder); + return _Monster.endMonster(builder); } serialize() { return this.bb.bytes(); } static deserialize(buffer) { - return Monster.getRootAsMonster(new flatbuffers4.ByteBuffer(buffer)); + return _Monster.getRootAsMonster(new flatbuffers4.ByteBuffer(buffer)); } unpack() { return new MonsterT(); @@ -406,7 +406,7 @@ var Color; })(Color = Color || (Color = {})); // my-game/example/test-simple-table-with-enum.js -var TestSimpleTableWithEnum = class { +var TestSimpleTableWithEnum = class _TestSimpleTableWithEnum { constructor() { this.bb = null; this.bb_pos = 0; @@ -417,11 +417,11 @@ var TestSimpleTableWithEnum = class { return this; } static getRootAsTestSimpleTableWithEnum(bb, obj) { - return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsTestSimpleTableWithEnum(bb, obj) { bb.setPosition(bb.position() + flatbuffers5.SIZE_PREFIX_LENGTH); - return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } color() { const offset = this.bb.__offset(this.bb_pos, 4); @@ -449,15 +449,15 @@ var TestSimpleTableWithEnum = class { return offset; } static createTestSimpleTableWithEnum(builder, color) { - TestSimpleTableWithEnum.startTestSimpleTableWithEnum(builder); - TestSimpleTableWithEnum.addColor(builder, color); - return TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder); + _TestSimpleTableWithEnum.startTestSimpleTableWithEnum(builder); + _TestSimpleTableWithEnum.addColor(builder, color); + return _TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder); } serialize() { return this.bb.bytes(); } static deserialize(buffer) { - return TestSimpleTableWithEnum.getRootAsTestSimpleTableWithEnum(new flatbuffers5.ByteBuffer(buffer)); + return _TestSimpleTableWithEnum.getRootAsTestSimpleTableWithEnum(new flatbuffers5.ByteBuffer(buffer)); } unpack() { return new TestSimpleTableWithEnumT(this.color()); @@ -509,7 +509,7 @@ var Race; // my-game/example/referrable.js var flatbuffers6 = __toESM(require("flatbuffers"), 1); -var Referrable = class { +var Referrable = class _Referrable { constructor() { this.bb = null; this.bb_pos = 0; @@ -520,11 +520,11 @@ var Referrable = class { return this; } static getRootAsReferrable(bb, obj) { - return (obj || new Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsReferrable(bb, obj) { bb.setPosition(bb.position() + flatbuffers6.SIZE_PREFIX_LENGTH); - return (obj || new Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } id() { const offset = this.bb.__offset(this.bb_pos, 4); @@ -552,15 +552,15 @@ var Referrable = class { return offset; } static createReferrable(builder, id) { - Referrable.startReferrable(builder); - Referrable.addId(builder, id); - return Referrable.endReferrable(builder); + _Referrable.startReferrable(builder); + _Referrable.addId(builder, id); + return _Referrable.endReferrable(builder); } serialize() { return this.bb.bytes(); } static deserialize(buffer) { - return Referrable.getRootAsReferrable(new flatbuffers6.ByteBuffer(buffer)); + return _Referrable.getRootAsReferrable(new flatbuffers6.ByteBuffer(buffer)); } unpack() { return new ReferrableT(this.id()); @@ -580,7 +580,7 @@ var ReferrableT = class { // my-game/example/stat.js var flatbuffers7 = __toESM(require("flatbuffers"), 1); -var Stat = class { +var Stat = class _Stat { constructor() { this.bb = null; this.bb_pos = 0; @@ -591,11 +591,11 @@ var Stat = class { return this; } static getRootAsStat(bb, obj) { - return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsStat(bb, obj) { bb.setPosition(bb.position() + flatbuffers7.SIZE_PREFIX_LENGTH); - return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } id(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 4); @@ -645,17 +645,17 @@ var Stat = class { return offset; } static createStat(builder, idOffset, val, count) { - Stat.startStat(builder); - Stat.addId(builder, idOffset); - Stat.addVal(builder, val); - Stat.addCount(builder, count); - return Stat.endStat(builder); + _Stat.startStat(builder); + _Stat.addId(builder, idOffset); + _Stat.addVal(builder, val); + _Stat.addCount(builder, count); + return _Stat.endStat(builder); } serialize() { return this.bb.bytes(); } static deserialize(buffer) { - return Stat.getRootAsStat(new flatbuffers7.ByteBuffer(buffer)); + return _Stat.getRootAsStat(new flatbuffers7.ByteBuffer(buffer)); } unpack() { return new StatT(this.id(), this.val(), this.count()); @@ -832,7 +832,7 @@ var Vec3T = class { }; // my-game/example/monster.js -var Monster2 = class { +var Monster2 = class _Monster { constructor() { this.bb = null; this.bb_pos = 0; @@ -843,11 +843,11 @@ var Monster2 = class { return this; } static getRootAsMonster(bb, obj) { - return (obj || new Monster2()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsMonster(bb, obj) { bb.setPosition(bb.position() + flatbuffers8.SIZE_PREFIX_LENGTH); - return (obj || new Monster2()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static bufferHasIdentifier(bb) { return bb.__has_identifier("MONS"); @@ -938,7 +938,7 @@ var Monster2 = class { */ testarrayoftables(index, obj) { const offset = this.bb.__offset(this.bb_pos, 26); - return offset ? (obj || new Monster2()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; + return offset ? (obj || new _Monster()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; } testarrayoftablesLength() { const offset = this.bb.__offset(this.bb_pos, 26); @@ -946,7 +946,7 @@ var Monster2 = class { } enemy(obj) { const offset = this.bb.__offset(this.bb_pos, 28); - return offset ? (obj || new Monster2()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; + return offset ? (obj || new _Monster()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } testnestedflatbuffer(index) { const offset = this.bb.__offset(this.bb_pos, 30); @@ -1823,7 +1823,7 @@ var Monster2 = class { return this.bb.bytes(); } static deserialize(buffer) { - return Monster2.getRootAsMonster(new flatbuffers8.ByteBuffer(buffer)); + return _Monster.getRootAsMonster(new flatbuffers8.ByteBuffer(buffer)); } unpack() { return new MonsterT2(this.pos() !== null ? this.pos().unpack() : null, this.mana(), this.hp(), this.name(), this.bb.createScalarList(this.inventory.bind(this), this.inventoryLength()), this.color(), this.testType(), (() => { @@ -2230,7 +2230,7 @@ var StructOfStructsOfStructsT = class { // my-game/example/type-aliases.js var flatbuffers9 = __toESM(require("flatbuffers"), 1); -var TypeAliases = class { +var TypeAliases = class _TypeAliases { constructor() { this.bb = null; this.bb_pos = 0; @@ -2241,11 +2241,11 @@ var TypeAliases = class { return this; } static getRootAsTypeAliases(bb, obj) { - return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsTypeAliases(bb, obj) { bb.setPosition(bb.position() + flatbuffers9.SIZE_PREFIX_LENGTH); - return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } i8() { const offset = this.bb.__offset(this.bb_pos, 4); @@ -2458,26 +2458,26 @@ var TypeAliases = class { return offset; } static createTypeAliases(builder, i8, u8, i16, u16, i32, u32, i64, u64, f32, f64, v8Offset, vf64Offset) { - TypeAliases.startTypeAliases(builder); - TypeAliases.addI8(builder, i8); - TypeAliases.addU8(builder, u8); - TypeAliases.addI16(builder, i16); - TypeAliases.addU16(builder, u16); - TypeAliases.addI32(builder, i32); - TypeAliases.addU32(builder, u32); - TypeAliases.addI64(builder, i64); - TypeAliases.addU64(builder, u64); - TypeAliases.addF32(builder, f32); - TypeAliases.addF64(builder, f64); - TypeAliases.addV8(builder, v8Offset); - TypeAliases.addVf64(builder, vf64Offset); - return TypeAliases.endTypeAliases(builder); + _TypeAliases.startTypeAliases(builder); + _TypeAliases.addI8(builder, i8); + _TypeAliases.addU8(builder, u8); + _TypeAliases.addI16(builder, i16); + _TypeAliases.addU16(builder, u16); + _TypeAliases.addI32(builder, i32); + _TypeAliases.addU32(builder, u32); + _TypeAliases.addI64(builder, i64); + _TypeAliases.addU64(builder, u64); + _TypeAliases.addF32(builder, f32); + _TypeAliases.addF64(builder, f64); + _TypeAliases.addV8(builder, v8Offset); + _TypeAliases.addVf64(builder, vf64Offset); + return _TypeAliases.endTypeAliases(builder); } serialize() { return this.bb.bytes(); } static deserialize(buffer) { - return TypeAliases.getRootAsTypeAliases(new flatbuffers9.ByteBuffer(buffer)); + return _TypeAliases.getRootAsTypeAliases(new flatbuffers9.ByteBuffer(buffer)); } unpack() { return new TypeAliasesT(this.i8(), this.u8(), this.i16(), this.u16(), this.i32(), this.u32(), this.i64(), this.u64(), this.f32(), this.f64(), this.bb.createScalarList(this.v8.bind(this), this.v8Length()), this.bb.createScalarList(this.vf64.bind(this), this.vf64Length())); diff --git a/tests/ts/my-game.js b/tests/ts/my-game.js index 75f45820444..59aabe994e3 100644 --- a/tests/ts/my-game.js +++ b/tests/ts/my-game.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export { InParentNamespace, InParentNamespaceT } from './my-game/in-parent-namespace.js'; export * as Example from './my-game/example.js'; export * as Example2 from './my-game/example2.js'; diff --git a/tests/ts/my-game/example.js b/tests/ts/my-game/example.js index d7e502db533..d63f78c7771 100644 --- a/tests/ts/my-game/example.js +++ b/tests/ts/my-game/example.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export { Ability, AbilityT } from './example/ability.js'; export { Any } from './example/any.js'; export { AnyAmbiguousAliases } from './example/any-ambiguous-aliases.js'; diff --git a/tests/ts/my-game/example/any-ambiguous-aliases.js b/tests/ts/my-game/example/any-ambiguous-aliases.js index 7d379dc7640..11b6aac4616 100644 --- a/tests/ts/my-game/example/any-ambiguous-aliases.js +++ b/tests/ts/my-game/example/any-ambiguous-aliases.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import { Monster } from '../../my-game/example/monster.js'; export var AnyAmbiguousAliases; (function (AnyAmbiguousAliases) { @@ -6,7 +7,7 @@ export var AnyAmbiguousAliases; AnyAmbiguousAliases[AnyAmbiguousAliases["M1"] = 1] = "M1"; AnyAmbiguousAliases[AnyAmbiguousAliases["M2"] = 2] = "M2"; AnyAmbiguousAliases[AnyAmbiguousAliases["M3"] = 3] = "M3"; -})(AnyAmbiguousAliases = AnyAmbiguousAliases || (AnyAmbiguousAliases = {})); +})(AnyAmbiguousAliases || (AnyAmbiguousAliases = {})); export function unionToAnyAmbiguousAliases(type, accessor) { switch (AnyAmbiguousAliases[type]) { case 'NONE': return null; diff --git a/tests/ts/my-game/example/any-unique-aliases.js b/tests/ts/my-game/example/any-unique-aliases.js index a7fa2c02c23..b254029355b 100644 --- a/tests/ts/my-game/example/any-unique-aliases.js +++ b/tests/ts/my-game/example/any-unique-aliases.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import { Monster as MyGame_Example2_Monster } from '../../my-game/example2/monster.js'; import { Monster } from '../../my-game/example/monster.js'; import { TestSimpleTableWithEnum } from '../../my-game/example/test-simple-table-with-enum.js'; @@ -8,7 +9,7 @@ export var AnyUniqueAliases; AnyUniqueAliases[AnyUniqueAliases["M"] = 1] = "M"; AnyUniqueAliases[AnyUniqueAliases["TS"] = 2] = "TS"; AnyUniqueAliases[AnyUniqueAliases["M2"] = 3] = "M2"; -})(AnyUniqueAliases = AnyUniqueAliases || (AnyUniqueAliases = {})); +})(AnyUniqueAliases || (AnyUniqueAliases = {})); export function unionToAnyUniqueAliases(type, accessor) { switch (AnyUniqueAliases[type]) { case 'NONE': return null; diff --git a/tests/ts/my-game/example/any.js b/tests/ts/my-game/example/any.js index 2b1c0184d27..ef2c3e8ae9b 100644 --- a/tests/ts/my-game/example/any.js +++ b/tests/ts/my-game/example/any.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import { Monster as MyGame_Example2_Monster } from '../../my-game/example2/monster.js'; import { Monster } from '../../my-game/example/monster.js'; import { TestSimpleTableWithEnum } from '../../my-game/example/test-simple-table-with-enum.js'; @@ -8,7 +9,7 @@ export var Any; Any[Any["Monster"] = 1] = "Monster"; Any[Any["TestSimpleTableWithEnum"] = 2] = "TestSimpleTableWithEnum"; Any[Any["MyGame_Example2_Monster"] = 3] = "MyGame_Example2_Monster"; -})(Any = Any || (Any = {})); +})(Any || (Any = {})); export function unionToAny(type, accessor) { switch (Any[type]) { case 'NONE': return null; diff --git a/tests/ts/my-game/example/color.js b/tests/ts/my-game/example/color.js index 0a057ccf64a..5f2f1fd53b4 100644 --- a/tests/ts/my-game/example/color.js +++ b/tests/ts/my-game/example/color.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ /** * Composite components of Monster color. */ @@ -14,4 +15,4 @@ export var Color; * \brief color Blue (1u << 3) */ Color[Color["Blue"] = 8] = "Blue"; -})(Color = Color || (Color = {})); +})(Color || (Color = {})); diff --git a/tests/ts/my-game/example/long-enum.js b/tests/ts/my-game/example/long-enum.js index 0180c2bdf96..10030720482 100644 --- a/tests/ts/my-game/example/long-enum.js +++ b/tests/ts/my-game/example/long-enum.js @@ -1,7 +1,8 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export var LongEnum; (function (LongEnum) { LongEnum["LongOne"] = "2"; LongEnum["LongTwo"] = "4"; LongEnum["LongBig"] = "1099511627776"; -})(LongEnum = LongEnum || (LongEnum = {})); +})(LongEnum || (LongEnum = {})); diff --git a/tests/ts/my-game/example/monster.js b/tests/ts/my-game/example/monster.js index 6d71945dfe7..11a6604b2b5 100644 --- a/tests/ts/my-game/example/monster.js +++ b/tests/ts/my-game/example/monster.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { Ability } from '../../my-game/example/ability.js'; import { Any, unionToAny } from '../../my-game/example/any.js'; diff --git a/tests/ts/my-game/example/race.js b/tests/ts/my-game/example/race.js index 11c7a41ecf4..26f54c5152b 100644 --- a/tests/ts/my-game/example/race.js +++ b/tests/ts/my-game/example/race.js @@ -1,8 +1,9 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export var Race; (function (Race) { Race[Race["None"] = -1] = "None"; Race[Race["Human"] = 0] = "Human"; Race[Race["Dwarf"] = 1] = "Dwarf"; Race[Race["Elf"] = 2] = "Elf"; -})(Race = Race || (Race = {})); +})(Race || (Race = {})); diff --git a/tests/ts/my-game/example/referrable.js b/tests/ts/my-game/example/referrable.js index 0370768dd65..e37d9b7c362 100644 --- a/tests/ts/my-game/example/referrable.js +++ b/tests/ts/my-game/example/referrable.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; export class Referrable { constructor() { diff --git a/tests/ts/my-game/example/stat.js b/tests/ts/my-game/example/stat.js index 46eec434414..8c168690333 100644 --- a/tests/ts/my-game/example/stat.js +++ b/tests/ts/my-game/example/stat.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; export class Stat { constructor() { diff --git a/tests/ts/my-game/example/test-simple-table-with-enum.js b/tests/ts/my-game/example/test-simple-table-with-enum.js index 821cca99266..b4e0cfb3160 100644 --- a/tests/ts/my-game/example/test-simple-table-with-enum.js +++ b/tests/ts/my-game/example/test-simple-table-with-enum.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { Color } from '../../my-game/example/color.js'; export class TestSimpleTableWithEnum { diff --git a/tests/ts/my-game/example/type-aliases.js b/tests/ts/my-game/example/type-aliases.js index f26f226c8bf..81f32772bd7 100644 --- a/tests/ts/my-game/example/type-aliases.js +++ b/tests/ts/my-game/example/type-aliases.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; export class TypeAliases { constructor() { diff --git a/tests/ts/my-game/example2.js b/tests/ts/my-game/example2.js index 796233a3a2a..2c599c5df5b 100644 --- a/tests/ts/my-game/example2.js +++ b/tests/ts/my-game/example2.js @@ -1,2 +1,3 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export { Monster, MonsterT } from './example2/monster.js'; diff --git a/tests/ts/my-game/example2/monster.js b/tests/ts/my-game/example2/monster.js index 17f02b11ecf..56d215f942b 100644 --- a/tests/ts/my-game/example2/monster.js +++ b/tests/ts/my-game/example2/monster.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; export class Monster { constructor() { diff --git a/tests/ts/my-game/in-parent-namespace.js b/tests/ts/my-game/in-parent-namespace.js index 48817411bc8..197d271e870 100644 --- a/tests/ts/my-game/in-parent-namespace.js +++ b/tests/ts/my-game/in-parent-namespace.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; export class InParentNamespace { constructor() { diff --git a/tests/ts/my-game/other-name-space.js b/tests/ts/my-game/other-name-space.js index bc3afbfbb96..6b80bdba64d 100644 --- a/tests/ts/my-game/other-name-space.js +++ b/tests/ts/my-game/other-name-space.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export { FromInclude } from './other-name-space/from-include.js'; export { TableB, TableBT } from './other-name-space/table-b.js'; export { Unused, UnusedT } from './other-name-space/unused.js'; diff --git a/tests/ts/my-game/other-name-space/from-include.js b/tests/ts/my-game/other-name-space/from-include.js index c6e6d08339a..e9d4e43a645 100644 --- a/tests/ts/my-game/other-name-space/from-include.js +++ b/tests/ts/my-game/other-name-space/from-include.js @@ -1,5 +1,6 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export var FromInclude; (function (FromInclude) { FromInclude["IncludeVal"] = "0"; -})(FromInclude = FromInclude || (FromInclude = {})); +})(FromInclude || (FromInclude = {})); diff --git a/tests/ts/my-game/other-name-space/from-include.ts b/tests/ts/my-game/other-name-space/from-include.ts index bdc066d5fe9..86305f24894 100644 --- a/tests/ts/my-game/other-name-space/from-include.ts +++ b/tests/ts/my-game/other-name-space/from-include.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export enum FromInclude { IncludeVal = '0' } diff --git a/tests/ts/my-game/other-name-space/table-b.js b/tests/ts/my-game/other-name-space/table-b.js index 5d951320284..74b170c88d5 100644 --- a/tests/ts/my-game/other-name-space/table-b.js +++ b/tests/ts/my-game/other-name-space/table-b.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { TableA } from '../../table-a.js'; export class TableB { diff --git a/tests/ts/my-game/other-name-space/table-b.ts b/tests/ts/my-game/other-name-space/table-b.ts index d18712b2611..264a7c44302 100644 --- a/tests/ts/my-game/other-name-space/table-b.ts +++ b/tests/ts/my-game/other-name-space/table-b.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { TableA, TableAT } from '../../table-a.js'; diff --git a/tests/ts/my-game/other-name-space/unused.ts b/tests/ts/my-game/other-name-space/unused.ts index 7f3dbd50893..6c22d1e2e16 100644 --- a/tests/ts/my-game/other-name-space/unused.ts +++ b/tests/ts/my-game/other-name-space/unused.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; diff --git a/tests/ts/no_import_ext/optional-scalars.ts b/tests/ts/no_import_ext/optional-scalars.ts index 4a83c439fcf..8fef7025af8 100644 --- a/tests/ts/no_import_ext/optional-scalars.ts +++ b/tests/ts/no_import_ext/optional-scalars.ts @@ -1,4 +1,6 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export { OptionalByte } from './optional-scalars/optional-byte'; export { ScalarStuff } from './optional-scalars/scalar-stuff'; diff --git a/tests/ts/no_import_ext/optional-scalars/optional-byte.ts b/tests/ts/no_import_ext/optional-scalars/optional-byte.ts index f4db265e2ba..9bb66a9bc14 100644 --- a/tests/ts/no_import_ext/optional-scalars/optional-byte.ts +++ b/tests/ts/no_import_ext/optional-scalars/optional-byte.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export enum OptionalByte { None = 0, One = 1, diff --git a/tests/ts/no_import_ext/optional-scalars/scalar-stuff.ts b/tests/ts/no_import_ext/optional-scalars/scalar-stuff.ts index d6256c384af..65ad076957d 100644 --- a/tests/ts/no_import_ext/optional-scalars/scalar-stuff.ts +++ b/tests/ts/no_import_ext/optional-scalars/scalar-stuff.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { OptionalByte } from '../optional-scalars/optional-byte'; diff --git a/tests/ts/no_import_ext/optional_scalars.ts b/tests/ts/no_import_ext/optional_scalars.ts index 18ded6e4f79..3805ab68c83 100644 --- a/tests/ts/no_import_ext/optional_scalars.ts +++ b/tests/ts/no_import_ext/optional_scalars.ts @@ -1,3 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export * as optional_scalars from './optional-scalars.js'; diff --git a/tests/ts/reflection.js b/tests/ts/reflection.js index b3239724580..ac0705641c2 100644 --- a/tests/ts/reflection.js +++ b/tests/ts/reflection.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export { AdvancedFeatures } from './reflection/advanced-features.js'; export { BaseType } from './reflection/base-type.js'; export { Enum, EnumT } from './reflection/enum.js'; diff --git a/tests/ts/reflection.ts b/tests/ts/reflection.ts index d62f1dcf5e9..a43d07d212d 100644 --- a/tests/ts/reflection.ts +++ b/tests/ts/reflection.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export { AdvancedFeatures } from './reflection/advanced-features.js'; export { BaseType } from './reflection/base-type.js'; export { Enum, EnumT } from './reflection/enum.js'; diff --git a/tests/ts/reflection/advanced-features.js b/tests/ts/reflection/advanced-features.js index 432bb44f528..aeef1a78da3 100644 --- a/tests/ts/reflection/advanced-features.js +++ b/tests/ts/reflection/advanced-features.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ /** * New schema language features that are not supported by old code generators. */ @@ -8,4 +9,4 @@ export var AdvancedFeatures; AdvancedFeatures["AdvancedUnionFeatures"] = "2"; AdvancedFeatures["OptionalScalars"] = "4"; AdvancedFeatures["DefaultVectorsAndStrings"] = "8"; -})(AdvancedFeatures = AdvancedFeatures || (AdvancedFeatures = {})); +})(AdvancedFeatures || (AdvancedFeatures = {})); diff --git a/tests/ts/reflection/advanced-features.ts b/tests/ts/reflection/advanced-features.ts index dd3b865063b..f68b7e24df9 100644 --- a/tests/ts/reflection/advanced-features.ts +++ b/tests/ts/reflection/advanced-features.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + /** * New schema language features that are not supported by old code generators. */ diff --git a/tests/ts/reflection/base-type.d.ts b/tests/ts/reflection/base-type.d.ts index 43ff4feb770..a4aea8bd17f 100644 --- a/tests/ts/reflection/base-type.d.ts +++ b/tests/ts/reflection/base-type.d.ts @@ -17,5 +17,6 @@ export declare enum BaseType { Obj = 15, Union = 16, Array = 17, - MaxBaseType = 18 + Vector64 = 18, + MaxBaseType = 19 } diff --git a/tests/ts/reflection/base-type.js b/tests/ts/reflection/base-type.js index b49e64b3bed..957d9fdc472 100644 --- a/tests/ts/reflection/base-type.js +++ b/tests/ts/reflection/base-type.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export var BaseType; (function (BaseType) { BaseType[BaseType["None"] = 0] = "None"; @@ -19,5 +20,6 @@ export var BaseType; BaseType[BaseType["Obj"] = 15] = "Obj"; BaseType[BaseType["Union"] = 16] = "Union"; BaseType[BaseType["Array"] = 17] = "Array"; - BaseType[BaseType["MaxBaseType"] = 18] = "MaxBaseType"; -})(BaseType = BaseType || (BaseType = {})); + BaseType[BaseType["Vector64"] = 18] = "Vector64"; + BaseType[BaseType["MaxBaseType"] = 19] = "MaxBaseType"; +})(BaseType || (BaseType = {})); diff --git a/tests/ts/reflection/base-type.ts b/tests/ts/reflection/base-type.ts index 7ee98ed998d..38ef9fa1cbb 100644 --- a/tests/ts/reflection/base-type.ts +++ b/tests/ts/reflection/base-type.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export enum BaseType { None = 0, UType = 1, @@ -19,5 +21,6 @@ export enum BaseType { Obj = 15, Union = 16, Array = 17, - MaxBaseType = 18 + Vector64 = 18, + MaxBaseType = 19 } diff --git a/tests/ts/reflection/enum-val.js b/tests/ts/reflection/enum-val.js index b4d0769d543..c937455006f 100644 --- a/tests/ts/reflection/enum-val.js +++ b/tests/ts/reflection/enum-val.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { KeyValue } from '../reflection/key-value.js'; import { Type } from '../reflection/type.js'; diff --git a/tests/ts/reflection/enum-val.ts b/tests/ts/reflection/enum-val.ts index 2576e7026c4..49e4a214fe8 100644 --- a/tests/ts/reflection/enum-val.ts +++ b/tests/ts/reflection/enum-val.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { KeyValue, KeyValueT } from '../reflection/key-value.js'; diff --git a/tests/ts/reflection/enum.js b/tests/ts/reflection/enum.js index a08a8cbfa66..e2cb6460ad1 100644 --- a/tests/ts/reflection/enum.js +++ b/tests/ts/reflection/enum.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { EnumVal } from '../reflection/enum-val.js'; import { KeyValue } from '../reflection/key-value.js'; diff --git a/tests/ts/reflection/enum.ts b/tests/ts/reflection/enum.ts index edf29f65bd9..88336a7a586 100644 --- a/tests/ts/reflection/enum.ts +++ b/tests/ts/reflection/enum.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { EnumVal, EnumValT } from '../reflection/enum-val.js'; diff --git a/tests/ts/reflection/field.d.ts b/tests/ts/reflection/field.d.ts index 42a2142b6d9..e4f4bf53904 100644 --- a/tests/ts/reflection/field.d.ts +++ b/tests/ts/reflection/field.d.ts @@ -36,6 +36,11 @@ export declare class Field implements flatbuffers.IUnpackableObject { */ padding(): number; mutate_padding(value: number): boolean; + /** + * If the field uses 64-bit offsets. + */ + offset64(): boolean; + mutate_offset64(value: boolean): boolean; static getFullyQualifiedName(): string; static startField(builder: flatbuffers.Builder): void; static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset): void; @@ -55,6 +60,7 @@ export declare class Field implements flatbuffers.IUnpackableObject { static startDocumentationVector(builder: flatbuffers.Builder, numElems: number): void; static addOptional(builder: flatbuffers.Builder, optional: boolean): void; static addPadding(builder: flatbuffers.Builder, padding: number): void; + static addOffset64(builder: flatbuffers.Builder, offset64: boolean): void; static endField(builder: flatbuffers.Builder): flatbuffers.Offset; unpack(): FieldT; unpackTo(_o: FieldT): void; @@ -73,6 +79,7 @@ export declare class FieldT implements flatbuffers.IGeneratedObject { documentation: (string)[]; optional: boolean; padding: number; - constructor(name?: string | Uint8Array | null, type?: TypeT | null, id?: number, offset?: number, defaultInteger?: bigint, defaultReal?: number, deprecated?: boolean, required?: boolean, key?: boolean, attributes?: (KeyValueT)[], documentation?: (string)[], optional?: boolean, padding?: number); + offset64: boolean; + constructor(name?: string | Uint8Array | null, type?: TypeT | null, id?: number, offset?: number, defaultInteger?: bigint, defaultReal?: number, deprecated?: boolean, required?: boolean, key?: boolean, attributes?: (KeyValueT)[], documentation?: (string)[], optional?: boolean, padding?: number, offset64?: boolean); pack(builder: flatbuffers.Builder): flatbuffers.Offset; } diff --git a/tests/ts/reflection/field.js b/tests/ts/reflection/field.js index 5d7e2f88c46..a8a8fd34733 100644 --- a/tests/ts/reflection/field.js +++ b/tests/ts/reflection/field.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { KeyValue } from '../reflection/key-value.js'; import { Type } from '../reflection/type.js'; @@ -154,11 +155,26 @@ export class Field { this.bb.writeUint16(this.bb_pos + offset, value); return true; } + /** + * If the field uses 64-bit offsets. + */ + offset64() { + const offset = this.bb.__offset(this.bb_pos, 30); + return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; + } + mutate_offset64(value) { + const offset = this.bb.__offset(this.bb_pos, 30); + if (offset === 0) { + return false; + } + this.bb.writeInt8(this.bb_pos + offset, +value); + return true; + } static getFullyQualifiedName() { return 'reflection.Field'; } static startField(builder) { - builder.startObject(13); + builder.startObject(14); } static addName(builder, nameOffset) { builder.addFieldOffset(0, nameOffset, 0); @@ -219,6 +235,9 @@ export class Field { static addPadding(builder, padding) { builder.addFieldInt16(12, padding, 0); } + static addOffset64(builder, offset64) { + builder.addFieldInt8(13, +offset64, +false); + } static endField(builder) { const offset = builder.endObject(); builder.requiredField(offset, 4); // name @@ -226,7 +245,7 @@ export class Field { 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()); + 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(), this.offset64()); } unpackTo(_o) { _o.name = this.name(); @@ -242,10 +261,11 @@ export class Field { _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()); _o.optional = this.optional(); _o.padding = this.padding(); + _o.offset64 = this.offset64(); } } 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) { + 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, offset64 = false) { this.name = name; this.type = type; this.id = id; @@ -259,6 +279,7 @@ export class FieldT { this.documentation = documentation; this.optional = optional; this.padding = padding; + this.offset64 = offset64; } pack(builder) { const name = (this.name !== null ? builder.createString(this.name) : 0); @@ -279,6 +300,7 @@ export class FieldT { Field.addDocumentation(builder, documentation); Field.addOptional(builder, this.optional); Field.addPadding(builder, this.padding); + Field.addOffset64(builder, this.offset64); return Field.endField(builder); } } diff --git a/tests/ts/reflection/field.ts b/tests/ts/reflection/field.ts index 653611710e3..75a2d342234 100644 --- a/tests/ts/reflection/field.ts +++ b/tests/ts/reflection/field.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { KeyValue, KeyValueT } from '../reflection/key-value.js'; @@ -205,12 +207,31 @@ mutate_padding(value:number):boolean { return true; } +/** + * If the field uses 64-bit offsets. + */ +offset64():boolean { + const offset = this.bb!.__offset(this.bb_pos, 30); + return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; +} + +mutate_offset64(value:boolean):boolean { + const offset = this.bb!.__offset(this.bb_pos, 30); + + if (offset === 0) { + return false; + } + + this.bb!.writeInt8(this.bb_pos + offset, +value); + return true; +} + static getFullyQualifiedName():string { return 'reflection.Field'; } static startField(builder:flatbuffers.Builder) { - builder.startObject(13); + builder.startObject(14); } static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) { @@ -289,6 +310,10 @@ static addPadding(builder:flatbuffers.Builder, padding:number) { builder.addFieldInt16(12, padding, 0); } +static addOffset64(builder:flatbuffers.Builder, offset64:boolean) { + builder.addFieldInt8(13, +offset64, +false); +} + static endField(builder:flatbuffers.Builder):flatbuffers.Offset { const offset = builder.endObject(); builder.requiredField(offset, 4) // name @@ -311,7 +336,8 @@ unpack(): FieldT { this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), this.optional(), - this.padding() + this.padding(), + this.offset64() ); } @@ -330,6 +356,7 @@ unpackTo(_o: FieldT): void { _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); _o.optional = this.optional(); _o.padding = this.padding(); + _o.offset64 = this.offset64(); } } @@ -347,7 +374,8 @@ constructor( public attributes: (KeyValueT)[] = [], public documentation: (string)[] = [], public optional: boolean = false, - public padding: number = 0 + public padding: number = 0, + public offset64: boolean = false ){} @@ -371,6 +399,7 @@ pack(builder:flatbuffers.Builder): flatbuffers.Offset { Field.addDocumentation(builder, documentation); Field.addOptional(builder, this.optional); Field.addPadding(builder, this.padding); + Field.addOffset64(builder, this.offset64); return Field.endField(builder); } diff --git a/tests/ts/reflection/key-value.js b/tests/ts/reflection/key-value.js index f8c6b856fb4..289e9eaef9a 100644 --- a/tests/ts/reflection/key-value.js +++ b/tests/ts/reflection/key-value.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; export class KeyValue { constructor() { diff --git a/tests/ts/reflection/key-value.ts b/tests/ts/reflection/key-value.ts index 8a1e4a09bef..8d7fe045996 100644 --- a/tests/ts/reflection/key-value.ts +++ b/tests/ts/reflection/key-value.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; diff --git a/tests/ts/reflection/object.js b/tests/ts/reflection/object.js index e3d15ecdef1..bf1edf8cbfb 100644 --- a/tests/ts/reflection/object.js +++ b/tests/ts/reflection/object.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { Field } from '../reflection/field.js'; import { KeyValue } from '../reflection/key-value.js'; diff --git a/tests/ts/reflection/object.ts b/tests/ts/reflection/object.ts index 3a05effce15..088b3300021 100644 --- a/tests/ts/reflection/object.ts +++ b/tests/ts/reflection/object.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { Field, FieldT } from '../reflection/field.js'; diff --git a/tests/ts/reflection/rpccall.js b/tests/ts/reflection/rpccall.js index 9dd1541a0ac..f7fa5743b11 100644 --- a/tests/ts/reflection/rpccall.js +++ b/tests/ts/reflection/rpccall.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { KeyValue } from '../reflection/key-value.js'; import { Object_ } from '../reflection/object.js'; diff --git a/tests/ts/reflection/rpccall.ts b/tests/ts/reflection/rpccall.ts index 61a862fc9b3..9202300426f 100644 --- a/tests/ts/reflection/rpccall.ts +++ b/tests/ts/reflection/rpccall.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { KeyValue, KeyValueT } from '../reflection/key-value.js'; diff --git a/tests/ts/reflection/schema-file.js b/tests/ts/reflection/schema-file.js index 1aeeac84863..cb4cf49ef6c 100644 --- a/tests/ts/reflection/schema-file.js +++ b/tests/ts/reflection/schema-file.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; /** * File specific information. diff --git a/tests/ts/reflection/schema-file.ts b/tests/ts/reflection/schema-file.ts index 6060b800d46..44544eb26ca 100644 --- a/tests/ts/reflection/schema-file.ts +++ b/tests/ts/reflection/schema-file.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; diff --git a/tests/ts/reflection/schema.js b/tests/ts/reflection/schema.js index 8cdb0c68ab0..ef474c556f8 100644 --- a/tests/ts/reflection/schema.js +++ b/tests/ts/reflection/schema.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { Enum } from '../reflection/enum.js'; import { Object_ } from '../reflection/object.js'; diff --git a/tests/ts/reflection/schema.ts b/tests/ts/reflection/schema.ts index 21e0e2cee12..53922de6225 100644 --- a/tests/ts/reflection/schema.ts +++ b/tests/ts/reflection/schema.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { Enum, EnumT } from '../reflection/enum.js'; diff --git a/tests/ts/reflection/service.js b/tests/ts/reflection/service.js index 3ce83f44fdc..0373c7d503b 100644 --- a/tests/ts/reflection/service.js +++ b/tests/ts/reflection/service.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { KeyValue } from '../reflection/key-value.js'; import { RPCCall } from '../reflection/rpccall.js'; diff --git a/tests/ts/reflection/service.ts b/tests/ts/reflection/service.ts index 7fd396f0ef3..2c2c62ddce4 100644 --- a/tests/ts/reflection/service.ts +++ b/tests/ts/reflection/service.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { KeyValue, KeyValueT } from '../reflection/key-value.js'; diff --git a/tests/ts/reflection/type.js b/tests/ts/reflection/type.js index 8deec2f8b0a..fc5f0e0eaa9 100644 --- a/tests/ts/reflection/type.js +++ b/tests/ts/reflection/type.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { BaseType } from '../reflection/base-type.js'; export class Type { diff --git a/tests/ts/reflection/type.ts b/tests/ts/reflection/type.ts index 118aee848a3..c6dfb928f2d 100644 --- a/tests/ts/reflection/type.ts +++ b/tests/ts/reflection/type.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { BaseType } from '../reflection/base-type.js'; diff --git a/tests/ts/table-a.js b/tests/ts/table-a.js index f0ade0dd6f0..b3bff4ada42 100644 --- a/tests/ts/table-a.js +++ b/tests/ts/table-a.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { TableB } from './my-game/other-name-space/table-b.js'; export class TableA { diff --git a/tests/ts/table-a.ts b/tests/ts/table-a.ts index 5ed4b315c45..9d47ed5286f 100644 --- a/tests/ts/table-a.ts +++ b/tests/ts/table-a.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { TableB, TableBT } from './my-game/other-name-space/table-b.js'; diff --git a/tests/ts/typescript.js b/tests/ts/typescript.js index 0ea0702fc67..aaa77b6f414 100644 --- a/tests/ts/typescript.js +++ b/tests/ts/typescript.js @@ -1,3 +1,4 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export { Object_ } from './typescript/object.js'; export { class_ } from './typescript/class.js'; diff --git a/tests/ts/typescript.ts b/tests/ts/typescript.ts index 216026ef09c..da50d15393d 100644 --- a/tests/ts/typescript.ts +++ b/tests/ts/typescript.ts @@ -1,4 +1,6 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export { Object_ } from './typescript/object.js'; export { class_ } from './typescript/class.js'; diff --git a/tests/ts/typescript/class.js b/tests/ts/typescript/class.js index 5d84d974a50..2dba0365e82 100644 --- a/tests/ts/typescript/class.js +++ b/tests/ts/typescript/class.js @@ -1,6 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export var class_; (function (class_) { class_[class_["new_"] = 0] = "new_"; class_[class_["instanceof_"] = 1] = "instanceof_"; -})(class_ = class_ || (class_ = {})); +})(class_ || (class_ = {})); diff --git a/tests/ts/typescript/class.ts b/tests/ts/typescript/class.ts index fd8f1457041..69b4a0ae6df 100644 --- a/tests/ts/typescript/class.ts +++ b/tests/ts/typescript/class.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export enum class_ { new_ = 0, instanceof_ = 1 diff --git a/tests/ts/typescript/object.js b/tests/ts/typescript/object.js index bde535ca228..c8b97691867 100644 --- a/tests/ts/typescript/object.js +++ b/tests/ts/typescript/object.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { Abc } from '../foobar/abc.js'; import { class_ as foobar_class_ } from '../foobar/class.js'; diff --git a/tests/ts/typescript/object.ts b/tests/ts/typescript/object.ts index f9cbc4881bc..c7760d8f139 100644 --- a/tests/ts/typescript/object.ts +++ b/tests/ts/typescript/object.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + import * as flatbuffers from 'flatbuffers'; import { Abc } from '../foobar/abc.js'; diff --git a/tests/ts/typescript_include.ts b/tests/ts/typescript_include.ts index b3242dd94e0..aabfb64fa2d 100644 --- a/tests/ts/typescript_include.ts +++ b/tests/ts/typescript_include.ts @@ -1,3 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export * as foobar from './foobar.js'; diff --git a/tests/ts/typescript_keywords.js b/tests/ts/typescript_keywords.js index 4d637f9ae23..60b7e5751b1 100644 --- a/tests/ts/typescript_keywords.js +++ b/tests/ts/typescript_keywords.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export * as foobar from './foobar.js'; export * as reflection from './reflection.js'; export * as typescript from './typescript.js'; diff --git a/tests/ts/typescript_keywords.ts b/tests/ts/typescript_keywords.ts index dda7dd409e9..77696e7a1c5 100644 --- a/tests/ts/typescript_keywords.ts +++ b/tests/ts/typescript_keywords.ts @@ -1,5 +1,7 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export * as foobar from './foobar.js'; export * as reflection from './reflection.js'; export * as typescript from './typescript.js'; diff --git a/tests/ts/typescript_keywords_generated.cjs b/tests/ts/typescript_keywords_generated.cjs index 5e2e1a870ae..2306aa8404b 100644 --- a/tests/ts/typescript_keywords_generated.cjs +++ b/tests/ts/typescript_keywords_generated.cjs @@ -115,7 +115,7 @@ var flatbuffers3 = __toESM(require("flatbuffers"), 1); // reflection/key-value.js var flatbuffers = __toESM(require("flatbuffers"), 1); -var KeyValue = class { +var KeyValue = class _KeyValue { constructor() { this.bb = null; this.bb_pos = 0; @@ -126,11 +126,11 @@ var KeyValue = class { return this; } static getRootAsKeyValue(bb, obj) { - return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + 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); + return (obj || new _KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } key(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 4); @@ -158,10 +158,10 @@ var KeyValue = class { return offset; } static createKeyValue(builder, keyOffset, valueOffset) { - KeyValue.startKeyValue(builder); - KeyValue.addKey(builder, keyOffset); - KeyValue.addValue(builder, valueOffset); - return KeyValue.endKeyValue(builder); + _KeyValue.startKeyValue(builder); + _KeyValue.addKey(builder, keyOffset); + _KeyValue.addValue(builder, valueOffset); + return _KeyValue.endKeyValue(builder); } unpack() { return new KeyValueT(this.key(), this.value()); @@ -185,7 +185,7 @@ var KeyValueT = class { // reflection/type.js var flatbuffers2 = __toESM(require("flatbuffers"), 1); -var Type = class { +var Type = class _Type { constructor() { this.bb = null; this.bb_pos = 0; @@ -196,11 +196,11 @@ var Type = class { return this; } static getRootAsType(bb, obj) { - return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsType(bb, obj) { bb.setPosition(bb.position() + flatbuffers2.SIZE_PREFIX_LENGTH); - return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } baseType() { const offset = this.bb.__offset(this.bb_pos, 4); @@ -309,14 +309,14 @@ var Type = class { 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); + _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()); @@ -345,7 +345,7 @@ var TypeT = class { }; // reflection/enum-val.js -var EnumVal = class { +var EnumVal = class _EnumVal { constructor() { this.bb = null; this.bb_pos = 0; @@ -356,11 +356,11 @@ var EnumVal = class { return this; } static getRootAsEnumVal(bb, obj) { - return (obj || new EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsEnumVal(bb, obj) { bb.setPosition(bb.position() + flatbuffers3.SIZE_PREFIX_LENGTH); - return (obj || new EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } name(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 4); @@ -479,7 +479,7 @@ var EnumValT = class { }; // reflection/enum.js -var Enum = class { +var Enum = class _Enum { constructor() { this.bb = null; this.bb_pos = 0; @@ -490,11 +490,11 @@ var Enum = class { return this; } static getRootAsEnum(bb, obj) { - return (obj || new Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsEnum(bb, obj) { bb.setPosition(bb.position() + flatbuffers4.SIZE_PREFIX_LENGTH); - return (obj || new Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } name(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 4); @@ -652,7 +652,7 @@ var EnumT = class { // reflection/field.js var flatbuffers5 = __toESM(require("flatbuffers"), 1); -var Field = class { +var Field = class _Field { constructor() { this.bb = null; this.bb_pos = 0; @@ -663,11 +663,11 @@ var Field = class { return this; } static getRootAsField(bb, obj) { - return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsField(bb, obj) { bb.setPosition(bb.position() + flatbuffers5.SIZE_PREFIX_LENGTH); - return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } name(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 4); @@ -935,7 +935,7 @@ var FieldT = class { // reflection/object.js var flatbuffers6 = __toESM(require("flatbuffers"), 1); -var Object_ = class { +var Object_ = class _Object_ { constructor() { this.bb = null; this.bb_pos = 0; @@ -946,11 +946,11 @@ var Object_ = class { return this; } static getRootAsObject(bb, obj) { - return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsObject(bb, obj) { bb.setPosition(bb.position() + flatbuffers6.SIZE_PREFIX_LENGTH); - return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } name(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 4); @@ -1087,16 +1087,16 @@ var Object_ = class { 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); + _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()); @@ -1135,7 +1135,7 @@ var Object_T = class { // reflection/rpccall.js var flatbuffers7 = __toESM(require("flatbuffers"), 1); -var RPCCall = class { +var RPCCall = class _RPCCall { constructor() { this.bb = null; this.bb_pos = 0; @@ -1146,11 +1146,11 @@ var RPCCall = class { return this; } static getRootAsRPCCall(bb, obj) { - return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsRPCCall(bb, obj) { bb.setPosition(bb.position() + flatbuffers7.SIZE_PREFIX_LENGTH); - return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } name(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 4); @@ -1268,7 +1268,7 @@ var flatbuffers10 = __toESM(require("flatbuffers"), 1); // reflection/schema-file.js var flatbuffers8 = __toESM(require("flatbuffers"), 1); -var SchemaFile = class { +var SchemaFile = class _SchemaFile { constructor() { this.bb = null; this.bb_pos = 0; @@ -1279,11 +1279,11 @@ var SchemaFile = class { return this; } static getRootAsSchemaFile(bb, obj) { - return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsSchemaFile(bb, obj) { bb.setPosition(bb.position() + flatbuffers8.SIZE_PREFIX_LENGTH); - return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } filename(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 4); @@ -1325,10 +1325,10 @@ var SchemaFile = class { return offset; } static createSchemaFile(builder, filenameOffset, includedFilenamesOffset) { - SchemaFile.startSchemaFile(builder); - SchemaFile.addFilename(builder, filenameOffset); - SchemaFile.addIncludedFilenames(builder, includedFilenamesOffset); - return SchemaFile.endSchemaFile(builder); + _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())); @@ -1352,7 +1352,7 @@ var SchemaFileT = class { // reflection/service.js var flatbuffers9 = __toESM(require("flatbuffers"), 1); -var Service = class { +var Service = class _Service { constructor() { this.bb = null; this.bb_pos = 0; @@ -1363,11 +1363,11 @@ var Service = class { return this; } static getRootAsService(bb, obj) { - return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsService(bb, obj) { bb.setPosition(bb.position() + flatbuffers9.SIZE_PREFIX_LENGTH); - return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } name(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 4); @@ -1458,13 +1458,13 @@ var Service = class { 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); + _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()); @@ -1496,7 +1496,7 @@ var ServiceT = class { }; // reflection/schema.js -var Schema = class { +var Schema = class _Schema { constructor() { this.bb = null; this.bb_pos = 0; @@ -1507,11 +1507,11 @@ var Schema = class { return this; } static getRootAsSchema(bb, obj) { - return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsSchema(bb, obj) { bb.setPosition(bb.position() + flatbuffers10.SIZE_PREFIX_LENGTH); - return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static bufferHasIdentifier(bb) { return bb.__has_identifier("BFBS"); @@ -1728,7 +1728,7 @@ var class_2; })(class_2 = class_2 || (class_2 = {})); // typescript/object.js -var Object_2 = class { +var Object_2 = class _Object_ { constructor() { this.bb = null; this.bb_pos = 0; @@ -1739,11 +1739,11 @@ var Object_2 = class { return this; } static getRootAsObject(bb, obj) { - return (obj || new Object_2()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsObject(bb, obj) { bb.setPosition(bb.position() + flatbuffers11.SIZE_PREFIX_LENGTH); - return (obj || new Object_2()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } return_() { const offset = this.bb.__offset(this.bb_pos, 4); diff --git a/tests/ts/typescript_transitive_include.ts b/tests/ts/typescript_transitive_include.ts index b3242dd94e0..aabfb64fa2d 100644 --- a/tests/ts/typescript_transitive_include.ts +++ b/tests/ts/typescript_transitive_include.ts @@ -1,3 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + export * as foobar from './foobar.js'; diff --git a/tests/ts/union-underlying-type.d.ts b/tests/ts/union-underlying-type.d.ts new file mode 100644 index 00000000000..41a06b5a4b9 --- /dev/null +++ b/tests/ts/union-underlying-type.d.ts @@ -0,0 +1,5 @@ +export { A, AT } from './union-underlying-type/a.js'; +export { ABC } from './union-underlying-type/abc.js'; +export { B, BT } from './union-underlying-type/b.js'; +export { C, CT } from './union-underlying-type/c.js'; +export { D, DT } from './union-underlying-type/d.js'; diff --git a/tests/ts/union-underlying-type.js b/tests/ts/union-underlying-type.js new file mode 100644 index 00000000000..5548134163a --- /dev/null +++ b/tests/ts/union-underlying-type.js @@ -0,0 +1,7 @@ +// automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ +export { A, AT } from './union-underlying-type/a.js'; +export { ABC } from './union-underlying-type/abc.js'; +export { B, BT } from './union-underlying-type/b.js'; +export { C, CT } from './union-underlying-type/c.js'; +export { D, DT } from './union-underlying-type/d.js'; diff --git a/tests/ts/union-underlying-type.ts b/tests/ts/union-underlying-type.ts new file mode 100644 index 00000000000..df14f067f60 --- /dev/null +++ b/tests/ts/union-underlying-type.ts @@ -0,0 +1,9 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + +export { A, AT } from './union-underlying-type/a.js'; +export { ABC } from './union-underlying-type/abc.js'; +export { B, BT } from './union-underlying-type/b.js'; +export { C, CT } from './union-underlying-type/c.js'; +export { D, DT } from './union-underlying-type/d.js'; diff --git a/tests/ts/union-underlying-type/a.d.ts b/tests/ts/union-underlying-type/a.d.ts new file mode 100644 index 00000000000..79b07cc04d5 --- /dev/null +++ b/tests/ts/union-underlying-type/a.d.ts @@ -0,0 +1,22 @@ +import * as flatbuffers from 'flatbuffers'; +export declare class A implements flatbuffers.IUnpackableObject { + bb: flatbuffers.ByteBuffer | null; + bb_pos: number; + __init(i: number, bb: flatbuffers.ByteBuffer): A; + static getRootAsA(bb: flatbuffers.ByteBuffer, obj?: A): A; + static getSizePrefixedRootAsA(bb: flatbuffers.ByteBuffer, obj?: A): A; + a(): number; + mutate_a(value: number): boolean; + static getFullyQualifiedName(): string; + static startA(builder: flatbuffers.Builder): void; + static addA(builder: flatbuffers.Builder, a: number): void; + static endA(builder: flatbuffers.Builder): flatbuffers.Offset; + static createA(builder: flatbuffers.Builder, a: number): flatbuffers.Offset; + unpack(): AT; + unpackTo(_o: AT): void; +} +export declare class AT implements flatbuffers.IGeneratedObject { + a: number; + constructor(a?: number); + pack(builder: flatbuffers.Builder): flatbuffers.Offset; +} diff --git a/tests/ts/union-underlying-type/a.js b/tests/ts/union-underlying-type/a.js new file mode 100644 index 00000000000..72854573249 --- /dev/null +++ b/tests/ts/union-underlying-type/a.js @@ -0,0 +1,65 @@ +// automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ +import * as flatbuffers from 'flatbuffers'; +export class A { + constructor() { + this.bb = null; + this.bb_pos = 0; + } + __init(i, bb) { + this.bb_pos = i; + this.bb = bb; + return this; + } + static getRootAsA(bb, obj) { + return (obj || new A()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + } + static getSizePrefixedRootAsA(bb, obj) { + bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); + return (obj || new A()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + } + a() { + const offset = this.bb.__offset(this.bb_pos, 4); + return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; + } + mutate_a(value) { + const offset = this.bb.__offset(this.bb_pos, 4); + if (offset === 0) { + return false; + } + this.bb.writeInt32(this.bb_pos + offset, value); + return true; + } + static getFullyQualifiedName() { + return 'UnionUnderlyingType.A'; + } + static startA(builder) { + builder.startObject(1); + } + static addA(builder, a) { + builder.addFieldInt32(0, a, 0); + } + static endA(builder) { + const offset = builder.endObject(); + return offset; + } + static createA(builder, a) { + A.startA(builder); + A.addA(builder, a); + return A.endA(builder); + } + unpack() { + return new AT(this.a()); + } + unpackTo(_o) { + _o.a = this.a(); + } +} +export class AT { + constructor(a = 0) { + this.a = a; + } + pack(builder) { + return A.createA(builder, this.a); + } +} diff --git a/tests/ts/union-underlying-type/a.ts b/tests/ts/union-underlying-type/a.ts new file mode 100644 index 00000000000..f0039a90cb6 --- /dev/null +++ b/tests/ts/union-underlying-type/a.ts @@ -0,0 +1,89 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + +import * as flatbuffers from 'flatbuffers'; + + + +export class A implements flatbuffers.IUnpackableObject { + bb: flatbuffers.ByteBuffer|null = null; + bb_pos = 0; + __init(i:number, bb:flatbuffers.ByteBuffer):A { + this.bb_pos = i; + this.bb = bb; + return this; +} + +static getRootAsA(bb:flatbuffers.ByteBuffer, obj?:A):A { + return (obj || new A()).__init(bb.readInt32(bb.position()) + bb.position(), bb); +} + +static getSizePrefixedRootAsA(bb:flatbuffers.ByteBuffer, obj?:A):A { + bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); + return (obj || new A()).__init(bb.readInt32(bb.position()) + bb.position(), bb); +} + +a():number { + const offset = this.bb!.__offset(this.bb_pos, 4); + return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; +} + +mutate_a(value:number):boolean { + const offset = this.bb!.__offset(this.bb_pos, 4); + + if (offset === 0) { + return false; + } + + this.bb!.writeInt32(this.bb_pos + offset, value); + return true; +} + +static getFullyQualifiedName():string { + return 'UnionUnderlyingType.A'; +} + +static startA(builder:flatbuffers.Builder) { + builder.startObject(1); +} + +static addA(builder:flatbuffers.Builder, a:number) { + builder.addFieldInt32(0, a, 0); +} + +static endA(builder:flatbuffers.Builder):flatbuffers.Offset { + const offset = builder.endObject(); + return offset; +} + +static createA(builder:flatbuffers.Builder, a:number):flatbuffers.Offset { + A.startA(builder); + A.addA(builder, a); + return A.endA(builder); +} + +unpack(): AT { + return new AT( + this.a() + ); +} + + +unpackTo(_o: AT): void { + _o.a = this.a(); +} +} + +export class AT implements flatbuffers.IGeneratedObject { +constructor( + public a: number = 0 +){} + + +pack(builder:flatbuffers.Builder): flatbuffers.Offset { + return A.createA(builder, + this.a + ); +} +} diff --git a/tests/ts/union-underlying-type/abc.d.ts b/tests/ts/union-underlying-type/abc.d.ts new file mode 100644 index 00000000000..1ebd5fdb5d9 --- /dev/null +++ b/tests/ts/union-underlying-type/abc.d.ts @@ -0,0 +1,11 @@ +import { A } from '../union-underlying-type/a.js'; +import { B } from '../union-underlying-type/b.js'; +import { C } from '../union-underlying-type/c.js'; +export declare enum ABC { + NONE = 0, + A = 555, + B = 666, + C = 777 +} +export declare function unionToAbc(type: ABC, accessor: (obj: A | B | C) => A | B | C | null): A | B | C | null; +export declare function unionListToAbc(type: ABC, accessor: (index: number, obj: A | B | C) => A | B | C | null, index: number): A | B | C | null; diff --git a/tests/ts/union-underlying-type/abc.js b/tests/ts/union-underlying-type/abc.js new file mode 100644 index 00000000000..a0434f1f936 --- /dev/null +++ b/tests/ts/union-underlying-type/abc.js @@ -0,0 +1,30 @@ +// automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ +import { A } from '../union-underlying-type/a.js'; +import { B } from '../union-underlying-type/b.js'; +import { C } from '../union-underlying-type/c.js'; +export var ABC; +(function (ABC) { + ABC[ABC["NONE"] = 0] = "NONE"; + ABC[ABC["A"] = 555] = "A"; + ABC[ABC["B"] = 666] = "B"; + ABC[ABC["C"] = 777] = "C"; +})(ABC || (ABC = {})); +export function unionToAbc(type, accessor) { + switch (ABC[type]) { + case 'NONE': return null; + case 'A': return accessor(new A()); + case 'B': return accessor(new B()); + case 'C': return accessor(new C()); + default: return null; + } +} +export function unionListToAbc(type, accessor, index) { + switch (ABC[type]) { + case 'NONE': return null; + case 'A': return accessor(index, new A()); + case 'B': return accessor(index, new B()); + case 'C': return accessor(index, new C()); + default: return null; + } +} diff --git a/tests/ts/union-underlying-type/abc.ts b/tests/ts/union-underlying-type/abc.ts new file mode 100644 index 00000000000..0ef1a79b975 --- /dev/null +++ b/tests/ts/union-underlying-type/abc.ts @@ -0,0 +1,42 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + +import { A, AT } from '../union-underlying-type/a.js'; +import { B, BT } from '../union-underlying-type/b.js'; +import { C, CT } from '../union-underlying-type/c.js'; + + +export enum ABC { + NONE = 0, + A = 555, + B = 666, + C = 777 +} + +export function unionToAbc( + type: ABC, + accessor: (obj:A|B|C) => A|B|C|null +): A|B|C|null { + switch(ABC[type]) { + case 'NONE': return null; + case 'A': return accessor(new A())! as A; + case 'B': return accessor(new B())! as B; + case 'C': return accessor(new C())! as C; + default: return null; + } +} + +export function unionListToAbc( + type: ABC, + accessor: (index: number, obj:A|B|C) => A|B|C|null, + index: number +): A|B|C|null { + switch(ABC[type]) { + case 'NONE': return null; + case 'A': return accessor(index, new A())! as A; + case 'B': return accessor(index, new B())! as B; + case 'C': return accessor(index, new C())! as C; + default: return null; + } +} diff --git a/tests/ts/union-underlying-type/b.d.ts b/tests/ts/union-underlying-type/b.d.ts new file mode 100644 index 00000000000..ea8b84d0902 --- /dev/null +++ b/tests/ts/union-underlying-type/b.d.ts @@ -0,0 +1,22 @@ +import * as flatbuffers from 'flatbuffers'; +export declare class B implements flatbuffers.IUnpackableObject { + bb: flatbuffers.ByteBuffer | null; + bb_pos: number; + __init(i: number, bb: flatbuffers.ByteBuffer): B; + static getRootAsB(bb: flatbuffers.ByteBuffer, obj?: B): B; + static getSizePrefixedRootAsB(bb: flatbuffers.ByteBuffer, obj?: B): B; + b(): string | null; + b(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null; + static getFullyQualifiedName(): string; + static startB(builder: flatbuffers.Builder): void; + static addB(builder: flatbuffers.Builder, bOffset: flatbuffers.Offset): void; + static endB(builder: flatbuffers.Builder): flatbuffers.Offset; + static createB(builder: flatbuffers.Builder, bOffset: flatbuffers.Offset): flatbuffers.Offset; + unpack(): BT; + unpackTo(_o: BT): void; +} +export declare class BT implements flatbuffers.IGeneratedObject { + b: string | Uint8Array | null; + constructor(b?: string | Uint8Array | null); + pack(builder: flatbuffers.Builder): flatbuffers.Offset; +} diff --git a/tests/ts/union-underlying-type/b.js b/tests/ts/union-underlying-type/b.js new file mode 100644 index 00000000000..85e67b224d2 --- /dev/null +++ b/tests/ts/union-underlying-type/b.js @@ -0,0 +1,58 @@ +// automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ +import * as flatbuffers from 'flatbuffers'; +export class B { + constructor() { + this.bb = null; + this.bb_pos = 0; + } + __init(i, bb) { + this.bb_pos = i; + this.bb = bb; + return this; + } + static getRootAsB(bb, obj) { + return (obj || new B()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + } + static getSizePrefixedRootAsB(bb, obj) { + bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); + return (obj || new B()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + } + b(optionalEncoding) { + const offset = this.bb.__offset(this.bb_pos, 4); + return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; + } + static getFullyQualifiedName() { + return 'UnionUnderlyingType.B'; + } + static startB(builder) { + builder.startObject(1); + } + static addB(builder, bOffset) { + builder.addFieldOffset(0, bOffset, 0); + } + static endB(builder) { + const offset = builder.endObject(); + return offset; + } + static createB(builder, bOffset) { + B.startB(builder); + B.addB(builder, bOffset); + return B.endB(builder); + } + unpack() { + return new BT(this.b()); + } + unpackTo(_o) { + _o.b = this.b(); + } +} +export class BT { + constructor(b = null) { + this.b = b; + } + pack(builder) { + const b = (this.b !== null ? builder.createString(this.b) : 0); + return B.createB(builder, b); + } +} diff --git a/tests/ts/union-underlying-type/b.ts b/tests/ts/union-underlying-type/b.ts new file mode 100644 index 00000000000..3be0a545810 --- /dev/null +++ b/tests/ts/union-underlying-type/b.ts @@ -0,0 +1,82 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + +import * as flatbuffers from 'flatbuffers'; + + + +export class B implements flatbuffers.IUnpackableObject { + bb: flatbuffers.ByteBuffer|null = null; + bb_pos = 0; + __init(i:number, bb:flatbuffers.ByteBuffer):B { + this.bb_pos = i; + this.bb = bb; + return this; +} + +static getRootAsB(bb:flatbuffers.ByteBuffer, obj?:B):B { + return (obj || new B()).__init(bb.readInt32(bb.position()) + bb.position(), bb); +} + +static getSizePrefixedRootAsB(bb:flatbuffers.ByteBuffer, obj?:B):B { + bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); + return (obj || new B()).__init(bb.readInt32(bb.position()) + bb.position(), bb); +} + +b():string|null +b(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null +b(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; +} + +static getFullyQualifiedName():string { + return 'UnionUnderlyingType.B'; +} + +static startB(builder:flatbuffers.Builder) { + builder.startObject(1); +} + +static addB(builder:flatbuffers.Builder, bOffset:flatbuffers.Offset) { + builder.addFieldOffset(0, bOffset, 0); +} + +static endB(builder:flatbuffers.Builder):flatbuffers.Offset { + const offset = builder.endObject(); + return offset; +} + +static createB(builder:flatbuffers.Builder, bOffset:flatbuffers.Offset):flatbuffers.Offset { + B.startB(builder); + B.addB(builder, bOffset); + return B.endB(builder); +} + +unpack(): BT { + return new BT( + this.b() + ); +} + + +unpackTo(_o: BT): void { + _o.b = this.b(); +} +} + +export class BT implements flatbuffers.IGeneratedObject { +constructor( + public b: string|Uint8Array|null = null +){} + + +pack(builder:flatbuffers.Builder): flatbuffers.Offset { + const b = (this.b !== null ? builder.createString(this.b!) : 0); + + return B.createB(builder, + b + ); +} +} diff --git a/tests/ts/union-underlying-type/c.d.ts b/tests/ts/union-underlying-type/c.d.ts new file mode 100644 index 00000000000..08d990ffb55 --- /dev/null +++ b/tests/ts/union-underlying-type/c.d.ts @@ -0,0 +1,22 @@ +import * as flatbuffers from 'flatbuffers'; +export declare class C implements flatbuffers.IUnpackableObject { + bb: flatbuffers.ByteBuffer | null; + bb_pos: number; + __init(i: number, bb: flatbuffers.ByteBuffer): C; + static getRootAsC(bb: flatbuffers.ByteBuffer, obj?: C): C; + static getSizePrefixedRootAsC(bb: flatbuffers.ByteBuffer, obj?: C): C; + c(): boolean; + mutate_c(value: boolean): boolean; + static getFullyQualifiedName(): string; + static startC(builder: flatbuffers.Builder): void; + static addC(builder: flatbuffers.Builder, c: boolean): void; + static endC(builder: flatbuffers.Builder): flatbuffers.Offset; + static createC(builder: flatbuffers.Builder, c: boolean): flatbuffers.Offset; + unpack(): CT; + unpackTo(_o: CT): void; +} +export declare class CT implements flatbuffers.IGeneratedObject { + c: boolean; + constructor(c?: boolean); + pack(builder: flatbuffers.Builder): flatbuffers.Offset; +} diff --git a/tests/ts/union-underlying-type/c.js b/tests/ts/union-underlying-type/c.js new file mode 100644 index 00000000000..48c38b78fff --- /dev/null +++ b/tests/ts/union-underlying-type/c.js @@ -0,0 +1,65 @@ +// automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ +import * as flatbuffers from 'flatbuffers'; +export class C { + constructor() { + this.bb = null; + this.bb_pos = 0; + } + __init(i, bb) { + this.bb_pos = i; + this.bb = bb; + return this; + } + static getRootAsC(bb, obj) { + return (obj || new C()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + } + static getSizePrefixedRootAsC(bb, obj) { + bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); + return (obj || new C()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + } + c() { + const offset = this.bb.__offset(this.bb_pos, 4); + return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; + } + mutate_c(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; + } + static getFullyQualifiedName() { + return 'UnionUnderlyingType.C'; + } + static startC(builder) { + builder.startObject(1); + } + static addC(builder, c) { + builder.addFieldInt8(0, +c, +false); + } + static endC(builder) { + const offset = builder.endObject(); + return offset; + } + static createC(builder, c) { + C.startC(builder); + C.addC(builder, c); + return C.endC(builder); + } + unpack() { + return new CT(this.c()); + } + unpackTo(_o) { + _o.c = this.c(); + } +} +export class CT { + constructor(c = false) { + this.c = c; + } + pack(builder) { + return C.createC(builder, this.c); + } +} diff --git a/tests/ts/union-underlying-type/c.ts b/tests/ts/union-underlying-type/c.ts new file mode 100644 index 00000000000..782c0c503be --- /dev/null +++ b/tests/ts/union-underlying-type/c.ts @@ -0,0 +1,89 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + +import * as flatbuffers from 'flatbuffers'; + + + +export class C implements flatbuffers.IUnpackableObject { + bb: flatbuffers.ByteBuffer|null = null; + bb_pos = 0; + __init(i:number, bb:flatbuffers.ByteBuffer):C { + this.bb_pos = i; + this.bb = bb; + return this; +} + +static getRootAsC(bb:flatbuffers.ByteBuffer, obj?:C):C { + return (obj || new C()).__init(bb.readInt32(bb.position()) + bb.position(), bb); +} + +static getSizePrefixedRootAsC(bb:flatbuffers.ByteBuffer, obj?:C):C { + bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); + return (obj || new C()).__init(bb.readInt32(bb.position()) + bb.position(), bb); +} + +c():boolean { + const offset = this.bb!.__offset(this.bb_pos, 4); + return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; +} + +mutate_c(value:boolean):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; +} + +static getFullyQualifiedName():string { + return 'UnionUnderlyingType.C'; +} + +static startC(builder:flatbuffers.Builder) { + builder.startObject(1); +} + +static addC(builder:flatbuffers.Builder, c:boolean) { + builder.addFieldInt8(0, +c, +false); +} + +static endC(builder:flatbuffers.Builder):flatbuffers.Offset { + const offset = builder.endObject(); + return offset; +} + +static createC(builder:flatbuffers.Builder, c:boolean):flatbuffers.Offset { + C.startC(builder); + C.addC(builder, c); + return C.endC(builder); +} + +unpack(): CT { + return new CT( + this.c() + ); +} + + +unpackTo(_o: CT): void { + _o.c = this.c(); +} +} + +export class CT implements flatbuffers.IGeneratedObject { +constructor( + public c: boolean = false +){} + + +pack(builder:flatbuffers.Builder): flatbuffers.Offset { + return C.createC(builder, + this.c + ); +} +} diff --git a/tests/ts/union-underlying-type/d.d.ts b/tests/ts/union-underlying-type/d.d.ts new file mode 100644 index 00000000000..fcb5f65233a --- /dev/null +++ b/tests/ts/union-underlying-type/d.d.ts @@ -0,0 +1,41 @@ +import * as flatbuffers from 'flatbuffers'; +import { AT } from '../union-underlying-type/a.js'; +import { ABC } from '../union-underlying-type/abc.js'; +import { BT } from '../union-underlying-type/b.js'; +import { CT } from '../union-underlying-type/c.js'; +export declare class D implements flatbuffers.IUnpackableObject
{ + bb: flatbuffers.ByteBuffer | null; + bb_pos: number; + __init(i: number, bb: flatbuffers.ByteBuffer): D; + static getRootAsD(bb: flatbuffers.ByteBuffer, obj?: D): D; + static getSizePrefixedRootAsD(bb: flatbuffers.ByteBuffer, obj?: D): D; + testUnionType(): ABC; + testUnion(obj: any): any | null; + testVectorOfUnionType(index: number): ABC | null; + testVectorOfUnionTypeLength(): number; + testVectorOfUnionTypeArray(): Int32Array | null; + testVectorOfUnion(index: number, obj: any): any | null; + testVectorOfUnionLength(): number; + static getFullyQualifiedName(): string; + static startD(builder: flatbuffers.Builder): void; + static addTestUnionType(builder: flatbuffers.Builder, testUnionType: ABC): void; + static addTestUnion(builder: flatbuffers.Builder, testUnionOffset: flatbuffers.Offset): void; + static addTestVectorOfUnionType(builder: flatbuffers.Builder, testVectorOfUnionTypeOffset: flatbuffers.Offset): void; + static createTestVectorOfUnionTypeVector(builder: flatbuffers.Builder, data: ABC[]): flatbuffers.Offset; + static startTestVectorOfUnionTypeVector(builder: flatbuffers.Builder, numElems: number): void; + static addTestVectorOfUnion(builder: flatbuffers.Builder, testVectorOfUnionOffset: flatbuffers.Offset): void; + static createTestVectorOfUnionVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset; + static startTestVectorOfUnionVector(builder: flatbuffers.Builder, numElems: number): void; + static endD(builder: flatbuffers.Builder): flatbuffers.Offset; + static createD(builder: flatbuffers.Builder, testUnionType: ABC, testUnionOffset: flatbuffers.Offset, testVectorOfUnionTypeOffset: flatbuffers.Offset, testVectorOfUnionOffset: flatbuffers.Offset): flatbuffers.Offset; + unpack(): DT; + unpackTo(_o: DT): void; +} +export declare class DT implements flatbuffers.IGeneratedObject { + testUnionType: ABC; + testUnion: AT | BT | CT | null; + testVectorOfUnionType: (ABC)[]; + testVectorOfUnion: (AT | BT | CT)[]; + constructor(testUnionType?: ABC, testUnion?: AT | BT | CT | null, testVectorOfUnionType?: (ABC)[], testVectorOfUnion?: (AT | BT | CT)[]); + pack(builder: flatbuffers.Builder): flatbuffers.Offset; +} diff --git a/tests/ts/union-underlying-type/d.js b/tests/ts/union-underlying-type/d.js new file mode 100644 index 00000000000..da66e15c056 --- /dev/null +++ b/tests/ts/union-underlying-type/d.js @@ -0,0 +1,163 @@ +// automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ +import * as flatbuffers from 'flatbuffers'; +import { ABC, unionToAbc, unionListToAbc } from '../union-underlying-type/abc.js'; +export class D { + constructor() { + this.bb = null; + this.bb_pos = 0; + } + __init(i, bb) { + this.bb_pos = i; + this.bb = bb; + return this; + } + static getRootAsD(bb, obj) { + return (obj || new D()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + } + static getSizePrefixedRootAsD(bb, obj) { + bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); + return (obj || new D()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + } + testUnionType() { + const offset = this.bb.__offset(this.bb_pos, 4); + return offset ? this.bb.readInt32(this.bb_pos + offset) : ABC.NONE; + } + testUnion(obj) { + const offset = this.bb.__offset(this.bb_pos, 6); + return offset ? this.bb.__union(obj, this.bb_pos + offset) : null; + } + testVectorOfUnionType(index) { + const offset = this.bb.__offset(this.bb_pos, 8); + return offset ? this.bb.readInt32(this.bb.__vector(this.bb_pos + offset) + index * 4) : 0; + } + testVectorOfUnionTypeLength() { + const offset = this.bb.__offset(this.bb_pos, 8); + return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; + } + testVectorOfUnionTypeArray() { + const offset = this.bb.__offset(this.bb_pos, 8); + return offset ? new Int32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null; + } + testVectorOfUnion(index, obj) { + const offset = this.bb.__offset(this.bb_pos, 10); + return offset ? this.bb.__union(obj, this.bb.__vector(this.bb_pos + offset) + index * 4) : null; + } + testVectorOfUnionLength() { + const offset = this.bb.__offset(this.bb_pos, 10); + return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; + } + static getFullyQualifiedName() { + return 'UnionUnderlyingType.D'; + } + static startD(builder) { + builder.startObject(4); + } + static addTestUnionType(builder, testUnionType) { + builder.addFieldInt32(0, testUnionType, ABC.NONE); + } + static addTestUnion(builder, testUnionOffset) { + builder.addFieldOffset(1, testUnionOffset, 0); + } + static addTestVectorOfUnionType(builder, testVectorOfUnionTypeOffset) { + builder.addFieldOffset(2, testVectorOfUnionTypeOffset, 0); + } + static createTestVectorOfUnionTypeVector(builder, data) { + builder.startVector(4, data.length, 4); + for (let i = data.length - 1; i >= 0; i--) { + builder.addInt32(data[i]); + } + return builder.endVector(); + } + static startTestVectorOfUnionTypeVector(builder, numElems) { + builder.startVector(4, numElems, 4); + } + static addTestVectorOfUnion(builder, testVectorOfUnionOffset) { + builder.addFieldOffset(3, testVectorOfUnionOffset, 0); + } + static createTestVectorOfUnionVector(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 startTestVectorOfUnionVector(builder, numElems) { + builder.startVector(4, numElems, 4); + } + static endD(builder) { + const offset = builder.endObject(); + return offset; + } + static createD(builder, testUnionType, testUnionOffset, testVectorOfUnionTypeOffset, testVectorOfUnionOffset) { + D.startD(builder); + D.addTestUnionType(builder, testUnionType); + D.addTestUnion(builder, testUnionOffset); + D.addTestVectorOfUnionType(builder, testVectorOfUnionTypeOffset); + D.addTestVectorOfUnion(builder, testVectorOfUnionOffset); + return D.endD(builder); + } + unpack() { + return new DT(this.testUnionType(), (() => { + const temp = unionToAbc(this.testUnionType(), this.testUnion.bind(this)); + if (temp === null) { + return null; + } + return temp.unpack(); + })(), this.bb.createScalarList(this.testVectorOfUnionType.bind(this), this.testVectorOfUnionTypeLength()), (() => { + const ret = []; + for (let targetEnumIndex = 0; targetEnumIndex < this.testVectorOfUnionTypeLength(); ++targetEnumIndex) { + const targetEnum = this.testVectorOfUnionType(targetEnumIndex); + if (targetEnum === null || ABC[targetEnum] === 'NONE') { + continue; + } + const temp = unionListToAbc(targetEnum, this.testVectorOfUnion.bind(this), targetEnumIndex); + if (temp === null) { + continue; + } + ret.push(temp.unpack()); + } + return ret; + })()); + } + unpackTo(_o) { + _o.testUnionType = this.testUnionType(); + _o.testUnion = (() => { + const temp = unionToAbc(this.testUnionType(), this.testUnion.bind(this)); + if (temp === null) { + return null; + } + return temp.unpack(); + })(); + _o.testVectorOfUnionType = this.bb.createScalarList(this.testVectorOfUnionType.bind(this), this.testVectorOfUnionTypeLength()); + _o.testVectorOfUnion = (() => { + const ret = []; + for (let targetEnumIndex = 0; targetEnumIndex < this.testVectorOfUnionTypeLength(); ++targetEnumIndex) { + const targetEnum = this.testVectorOfUnionType(targetEnumIndex); + if (targetEnum === null || ABC[targetEnum] === 'NONE') { + continue; + } + const temp = unionListToAbc(targetEnum, this.testVectorOfUnion.bind(this), targetEnumIndex); + if (temp === null) { + continue; + } + ret.push(temp.unpack()); + } + return ret; + })(); + } +} +export class DT { + constructor(testUnionType = ABC.NONE, testUnion = null, testVectorOfUnionType = [], testVectorOfUnion = []) { + this.testUnionType = testUnionType; + this.testUnion = testUnion; + this.testVectorOfUnionType = testVectorOfUnionType; + this.testVectorOfUnion = testVectorOfUnion; + } + pack(builder) { + const testUnion = builder.createObjectOffset(this.testUnion); + const testVectorOfUnionType = D.createTestVectorOfUnionTypeVector(builder, this.testVectorOfUnionType); + const testVectorOfUnion = D.createTestVectorOfUnionVector(builder, builder.createObjectOffsetList(this.testVectorOfUnion)); + return D.createD(builder, this.testUnionType, testUnion, testVectorOfUnionType, testVectorOfUnion); + } +} diff --git a/tests/ts/union-underlying-type/d.ts b/tests/ts/union-underlying-type/d.ts new file mode 100644 index 00000000000..c90e167d130 --- /dev/null +++ b/tests/ts/union-underlying-type/d.ts @@ -0,0 +1,197 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + +import * as flatbuffers from 'flatbuffers'; + +import { A, AT } from '../union-underlying-type/a.js'; +import { ABC, unionToAbc, unionListToAbc } from '../union-underlying-type/abc.js'; +import { B, BT } from '../union-underlying-type/b.js'; +import { C, CT } from '../union-underlying-type/c.js'; + + +export class D implements flatbuffers.IUnpackableObject
{ + bb: flatbuffers.ByteBuffer|null = null; + bb_pos = 0; + __init(i:number, bb:flatbuffers.ByteBuffer):D { + this.bb_pos = i; + this.bb = bb; + return this; +} + +static getRootAsD(bb:flatbuffers.ByteBuffer, obj?:D):D { + return (obj || new D()).__init(bb.readInt32(bb.position()) + bb.position(), bb); +} + +static getSizePrefixedRootAsD(bb:flatbuffers.ByteBuffer, obj?:D):D { + bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); + return (obj || new D()).__init(bb.readInt32(bb.position()) + bb.position(), bb); +} + +testUnionType():ABC { + const offset = this.bb!.__offset(this.bb_pos, 4); + return offset ? this.bb!.readInt32(this.bb_pos + offset) : ABC.NONE; +} + +testUnion(obj:any):any|null { + const offset = this.bb!.__offset(this.bb_pos, 6); + return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null; +} + +testVectorOfUnionType(index: number):ABC|null { + const offset = this.bb!.__offset(this.bb_pos, 8); + return offset ? this.bb!.readInt32(this.bb!.__vector(this.bb_pos + offset) + index * 4) : 0; +} + +testVectorOfUnionTypeLength():number { + const offset = this.bb!.__offset(this.bb_pos, 8); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; +} + +testVectorOfUnionTypeArray():Int32Array|null { + const offset = this.bb!.__offset(this.bb_pos, 8); + return offset ? new Int32Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null; +} + +testVectorOfUnion(index: number, obj:any):any|null { + const offset = this.bb!.__offset(this.bb_pos, 10); + return offset ? this.bb!.__union(obj, this.bb!.__vector(this.bb_pos + offset) + index * 4) : null; +} + +testVectorOfUnionLength():number { + const offset = this.bb!.__offset(this.bb_pos, 10); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; +} + +static getFullyQualifiedName():string { + return 'UnionUnderlyingType.D'; +} + +static startD(builder:flatbuffers.Builder) { + builder.startObject(4); +} + +static addTestUnionType(builder:flatbuffers.Builder, testUnionType:ABC) { + builder.addFieldInt32(0, testUnionType, ABC.NONE); +} + +static addTestUnion(builder:flatbuffers.Builder, testUnionOffset:flatbuffers.Offset) { + builder.addFieldOffset(1, testUnionOffset, 0); +} + +static addTestVectorOfUnionType(builder:flatbuffers.Builder, testVectorOfUnionTypeOffset:flatbuffers.Offset) { + builder.addFieldOffset(2, testVectorOfUnionTypeOffset, 0); +} + +static createTestVectorOfUnionTypeVector(builder:flatbuffers.Builder, data:ABC[]):flatbuffers.Offset { + builder.startVector(4, data.length, 4); + for (let i = data.length - 1; i >= 0; i--) { + builder.addInt32(data[i]!); + } + return builder.endVector(); +} + +static startTestVectorOfUnionTypeVector(builder:flatbuffers.Builder, numElems:number) { + builder.startVector(4, numElems, 4); +} + +static addTestVectorOfUnion(builder:flatbuffers.Builder, testVectorOfUnionOffset:flatbuffers.Offset) { + builder.addFieldOffset(3, testVectorOfUnionOffset, 0); +} + +static createTestVectorOfUnionVector(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 startTestVectorOfUnionVector(builder:flatbuffers.Builder, numElems:number) { + builder.startVector(4, numElems, 4); +} + +static endD(builder:flatbuffers.Builder):flatbuffers.Offset { + const offset = builder.endObject(); + return offset; +} + +static createD(builder:flatbuffers.Builder, testUnionType:ABC, testUnionOffset:flatbuffers.Offset, testVectorOfUnionTypeOffset:flatbuffers.Offset, testVectorOfUnionOffset:flatbuffers.Offset):flatbuffers.Offset { + D.startD(builder); + D.addTestUnionType(builder, testUnionType); + D.addTestUnion(builder, testUnionOffset); + D.addTestVectorOfUnionType(builder, testVectorOfUnionTypeOffset); + D.addTestVectorOfUnion(builder, testVectorOfUnionOffset); + return D.endD(builder); +} + +unpack(): DT { + return new DT( + this.testUnionType(), + (() => { + const temp = unionToAbc(this.testUnionType(), this.testUnion.bind(this)); + if(temp === null) { return null; } + return temp.unpack() + })(), + this.bb!.createScalarList(this.testVectorOfUnionType.bind(this), this.testVectorOfUnionTypeLength()), + (() => { + const ret: (AT|BT|CT)[] = []; + for(let targetEnumIndex = 0; targetEnumIndex < this.testVectorOfUnionTypeLength(); ++targetEnumIndex) { + const targetEnum = this.testVectorOfUnionType(targetEnumIndex); + if(targetEnum === null || ABC[targetEnum!] === 'NONE') { continue; } + + const temp = unionListToAbc(targetEnum, this.testVectorOfUnion.bind(this), targetEnumIndex); + if(temp === null) { continue; } + ret.push(temp.unpack()); + } + return ret; + })() + ); +} + + +unpackTo(_o: DT): void { + _o.testUnionType = this.testUnionType(); + _o.testUnion = (() => { + const temp = unionToAbc(this.testUnionType(), this.testUnion.bind(this)); + if(temp === null) { return null; } + return temp.unpack() + })(); + _o.testVectorOfUnionType = this.bb!.createScalarList(this.testVectorOfUnionType.bind(this), this.testVectorOfUnionTypeLength()); + _o.testVectorOfUnion = (() => { + const ret: (AT|BT|CT)[] = []; + for(let targetEnumIndex = 0; targetEnumIndex < this.testVectorOfUnionTypeLength(); ++targetEnumIndex) { + const targetEnum = this.testVectorOfUnionType(targetEnumIndex); + if(targetEnum === null || ABC[targetEnum!] === 'NONE') { continue; } + + const temp = unionListToAbc(targetEnum, this.testVectorOfUnion.bind(this), targetEnumIndex); + if(temp === null) { continue; } + ret.push(temp.unpack()); + } + return ret; + })(); +} +} + +export class DT implements flatbuffers.IGeneratedObject { +constructor( + public testUnionType: ABC = ABC.NONE, + public testUnion: AT|BT|CT|null = null, + public testVectorOfUnionType: (ABC)[] = [], + public testVectorOfUnion: (AT|BT|CT)[] = [] +){} + + +pack(builder:flatbuffers.Builder): flatbuffers.Offset { + const testUnion = builder.createObjectOffset(this.testUnion); + const testVectorOfUnionType = D.createTestVectorOfUnionTypeVector(builder, this.testVectorOfUnionType); + const testVectorOfUnion = D.createTestVectorOfUnionVector(builder, builder.createObjectOffsetList(this.testVectorOfUnion)); + + return D.createD(builder, + this.testUnionType, + testUnion, + testVectorOfUnionType, + testVectorOfUnion + ); +} +} diff --git a/tests/ts/union_underlying_type_test.d.ts b/tests/ts/union_underlying_type_test.d.ts new file mode 100644 index 00000000000..2b5d2756b29 --- /dev/null +++ b/tests/ts/union_underlying_type_test.d.ts @@ -0,0 +1 @@ +export * as UnionUnderlyingType from './union-underlying-type.js'; diff --git a/tests/ts/union_underlying_type_test.js b/tests/ts/union_underlying_type_test.js new file mode 100644 index 00000000000..d4649b33622 --- /dev/null +++ b/tests/ts/union_underlying_type_test.js @@ -0,0 +1,3 @@ +// automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ +export * as UnionUnderlyingType from './union-underlying-type.js'; diff --git a/tests/ts/union_underlying_type_test.ts b/tests/ts/union_underlying_type_test.ts new file mode 100644 index 00000000000..973961609ab --- /dev/null +++ b/tests/ts/union_underlying_type_test.ts @@ -0,0 +1,5 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ + +export * as UnionUnderlyingType from './union-underlying-type.js'; diff --git a/tests/ts/union_vector/attacker.js b/tests/ts/union_vector/attacker.js index 32be94e2cbd..28ffc4a77b8 100644 --- a/tests/ts/union_vector/attacker.js +++ b/tests/ts/union_vector/attacker.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; export class Attacker { constructor() { diff --git a/tests/ts/union_vector/character.js b/tests/ts/union_vector/character.js index 0ef2ed16d82..dfa7a1914b3 100644 --- a/tests/ts/union_vector/character.js +++ b/tests/ts/union_vector/character.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import { Attacker } from './attacker.js'; import { BookReader } from './book-reader.js'; import { Rapunzel } from './rapunzel.js'; @@ -11,7 +12,7 @@ export var Character; Character[Character["BookFan"] = 4] = "BookFan"; Character[Character["Other"] = 5] = "Other"; Character[Character["Unused"] = 6] = "Unused"; -})(Character = Character || (Character = {})); +})(Character || (Character = {})); export function unionToCharacter(type, accessor) { switch (Character[type]) { case 'NONE': return null; diff --git a/tests/ts/union_vector/gadget.js b/tests/ts/union_vector/gadget.js index 5eb339b948b..1618ccce0fb 100644 --- a/tests/ts/union_vector/gadget.js +++ b/tests/ts/union_vector/gadget.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import { FallingTub } from './falling-tub.js'; import { HandFan } from './hand-fan.js'; export var Gadget; @@ -6,7 +7,7 @@ export var Gadget; Gadget[Gadget["NONE"] = 0] = "NONE"; Gadget[Gadget["FallingTub"] = 1] = "FallingTub"; Gadget[Gadget["HandFan"] = 2] = "HandFan"; -})(Gadget = Gadget || (Gadget = {})); +})(Gadget || (Gadget = {})); export function unionToGadget(type, accessor) { switch (Gadget[type]) { case 'NONE': return null; diff --git a/tests/ts/union_vector/hand-fan.js b/tests/ts/union_vector/hand-fan.js index 21decca26f5..b85b6d38caa 100644 --- a/tests/ts/union_vector/hand-fan.js +++ b/tests/ts/union_vector/hand-fan.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; export class HandFan { constructor() { diff --git a/tests/ts/union_vector/movie.js b/tests/ts/union_vector/movie.js index 53374ebd669..da5d1fadaa4 100644 --- a/tests/ts/union_vector/movie.js +++ b/tests/ts/union_vector/movie.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { Character, unionToCharacter, unionListToCharacter } from './character.js'; export class Movie { diff --git a/tests/ts/union_vector/union_vector.js b/tests/ts/union_vector/union_vector.js index 3e9b22bd71e..63b782e7d19 100644 --- a/tests/ts/union_vector/union_vector.js +++ b/tests/ts/union_vector/union_vector.js @@ -1,4 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ export { Attacker, AttackerT } from './attacker.js'; export { BookReader, BookReaderT } from './book-reader.js'; export { Character } from './character.js'; diff --git a/tests/ts/union_vector/union_vector_generated.cjs b/tests/ts/union_vector/union_vector_generated.cjs index b63140cd685..d0c41344490 100644 --- a/tests/ts/union_vector/union_vector_generated.cjs +++ b/tests/ts/union_vector/union_vector_generated.cjs @@ -49,7 +49,7 @@ module.exports = __toCommonJS(union_vector_exports); // union_vector/attacker.js var flatbuffers = __toESM(require("flatbuffers"), 1); -var Attacker = class { +var Attacker = class _Attacker { constructor() { this.bb = null; this.bb_pos = 0; @@ -60,11 +60,11 @@ var Attacker = class { return this; } static getRootAsAttacker(bb, obj) { - return (obj || new Attacker()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Attacker()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsAttacker(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new Attacker()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Attacker()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } swordAttackDamage() { const offset = this.bb.__offset(this.bb_pos, 4); @@ -92,9 +92,9 @@ var Attacker = class { return offset; } static createAttacker(builder, swordAttackDamage) { - Attacker.startAttacker(builder); - Attacker.addSwordAttackDamage(builder, swordAttackDamage); - return Attacker.endAttacker(builder); + _Attacker.startAttacker(builder); + _Attacker.addSwordAttackDamage(builder, swordAttackDamage); + return _Attacker.endAttacker(builder); } unpack() { return new AttackerT(this.swordAttackDamage()); @@ -301,7 +301,7 @@ var FallingTubT = class { // union_vector/hand-fan.js var flatbuffers2 = __toESM(require("flatbuffers"), 1); -var HandFan = class { +var HandFan = class _HandFan { constructor() { this.bb = null; this.bb_pos = 0; @@ -312,11 +312,11 @@ var HandFan = class { return this; } static getRootAsHandFan(bb, obj) { - return (obj || new HandFan()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _HandFan()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsHandFan(bb, obj) { bb.setPosition(bb.position() + flatbuffers2.SIZE_PREFIX_LENGTH); - return (obj || new HandFan()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _HandFan()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } length() { const offset = this.bb.__offset(this.bb_pos, 4); @@ -344,9 +344,9 @@ var HandFan = class { return offset; } static createHandFan(builder, length) { - HandFan.startHandFan(builder); - HandFan.addLength(builder, length); - return HandFan.endHandFan(builder); + _HandFan.startHandFan(builder); + _HandFan.addLength(builder, length); + return _HandFan.endHandFan(builder); } unpack() { return new HandFanT(this.length()); @@ -374,7 +374,7 @@ var Gadget; // union_vector/movie.js var flatbuffers3 = __toESM(require("flatbuffers"), 1); -var Movie = class { +var Movie = class _Movie { constructor() { this.bb = null; this.bb_pos = 0; @@ -385,11 +385,11 @@ var Movie = class { return this; } static getRootAsMovie(bb, obj) { - return (obj || new Movie()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Movie()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsMovie(bb, obj) { bb.setPosition(bb.position() + flatbuffers3.SIZE_PREFIX_LENGTH); - return (obj || new Movie()).__init(bb.readInt32(bb.position()) + bb.position(), bb); + return (obj || new _Movie()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static bufferHasIdentifier(bb) { return bb.__has_identifier("MOVI"); @@ -471,12 +471,12 @@ var Movie = class { builder.finish(offset, "MOVI", true); } static createMovie(builder, mainCharacterType, mainCharacterOffset, charactersTypeOffset, charactersOffset) { - Movie.startMovie(builder); - Movie.addMainCharacterType(builder, mainCharacterType); - Movie.addMainCharacter(builder, mainCharacterOffset); - Movie.addCharactersType(builder, charactersTypeOffset); - Movie.addCharacters(builder, charactersOffset); - return Movie.endMovie(builder); + _Movie.startMovie(builder); + _Movie.addMainCharacterType(builder, mainCharacterType); + _Movie.addMainCharacter(builder, mainCharacterOffset); + _Movie.addCharactersType(builder, charactersTypeOffset); + _Movie.addCharacters(builder, charactersOffset); + return _Movie.endMovie(builder); } unpack() { return new MovieT(this.mainCharacterType(), (() => {