diff --git a/src/idl_gen_ts.cpp b/src/idl_gen_ts.cpp index 7a50cbe64..4462e0609 100644 --- a/src/idl_gen_ts.cpp +++ b/src/idl_gen_ts.cpp @@ -296,11 +296,11 @@ class TsGenerator : public BaseGenerator { auto fully_qualified_type_name = it.second.ns->GetFullyQualifiedName(type_name); auto is_struct = parser_.structs_.Lookup(fully_qualified_type_name); - code += "export { " + type_name; + code += "export {" + type_name; if (parser_.opts.generate_object_based_api && is_struct) { code += ", " + type_name + parser_.opts.object_suffix; } - code += " } from '"; + code += "} from '"; std::string import_extension = parser_.opts.ts_no_import_ext ? "" : ".js"; code += base_name_rel + import_extension + "';\n"; @@ -1040,7 +1040,7 @@ class TsGenerator : public BaseGenerator { std::string import_extension = parser_.opts.ts_no_import_ext ? "" : ".js"; import.import_statement = "import { " + symbols_expression + " } from '" + rel_file_path + import_extension + "';"; - import.export_statement = "export { " + symbols_expression + " } from '." + + import.export_statement = "export {" + symbols_expression + "} from '." + bare_file_path + import_extension + "';"; import.dependency = &dependency; import.dependent = &dependent; diff --git a/tests/ts/arrays_test_complex/my-game/example.ts b/tests/ts/arrays_test_complex/my-game/example.ts index 4f1d63b4e..eb01ee15d 100644 --- a/tests/ts/arrays_test_complex/my-game/example.ts +++ b/tests/ts/arrays_test_complex/my-game/example.ts @@ -2,9 +2,9 @@ /* 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'; -export { NestedStruct, NestedStructT } from './example/nested-struct.js'; -export { OuterStruct, OuterStructT } from './example/outer-struct.js'; -export { TestEnum } from './example/test-enum.js'; +export {ArrayStruct, ArrayStructT} from './example/array-struct.js'; +export {ArrayTable, ArrayTableT} from './example/array-table.js'; +export {InnerStruct, InnerStructT} from './example/inner-struct.js'; +export {NestedStruct, NestedStructT} from './example/nested-struct.js'; +export {OuterStruct, OuterStructT} from './example/outer-struct.js'; +export {TestEnum} from './example/test-enum.js'; diff --git a/tests/ts/com/company/test.ts b/tests/ts/com/company/test.ts index 87f26d217..4aa9c55ec 100644 --- a/tests/ts/com/company/test.ts +++ b/tests/ts/com/company/test.ts @@ -2,4 +2,4 @@ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ -export { Person } from './test/person.js'; +export {Person} from './test/person.js'; diff --git a/tests/ts/even_more_defaults.ts b/tests/ts/even_more_defaults.ts index 84f4c2925..2be8398e3 100644 --- a/tests/ts/even_more_defaults.ts +++ b/tests/ts/even_more_defaults.ts @@ -2,6 +2,6 @@ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ -export { ABC } from './abc.js'; -export { EvenMoreDefaults, EvenMoreDefaultsT } from './even-more-defaults.js'; -export { EvenMoreStruct, EvenMoreStructT } from './even-more-struct.js'; +export {ABC} from './abc.js'; +export {EvenMoreDefaults, EvenMoreDefaultsT} from './even-more-defaults.js'; +export {EvenMoreStruct, EvenMoreStructT} from './even-more-struct.js'; diff --git a/tests/ts/foobar.ts b/tests/ts/foobar.ts index e513600c6..57d1f73a9 100644 --- a/tests/ts/foobar.ts +++ b/tests/ts/foobar.ts @@ -2,4 +2,4 @@ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ -export { Abc } from './foobar/abc.js'; +export {Abc} from './foobar/abc.js'; diff --git a/tests/ts/longer-namespace/a/b/c.ts b/tests/ts/longer-namespace/a/b/c.ts index a30937e06..05f84e137 100644 --- a/tests/ts/longer-namespace/a/b/c.ts +++ b/tests/ts/longer-namespace/a/b/c.ts @@ -2,4 +2,4 @@ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ -export { Person } from './c/person.js'; +export {Person} from './c/person.js'; diff --git a/tests/ts/monster_test.ts b/tests/ts/monster_test.ts index 02e6f14a1..52bbf2751 100644 --- a/tests/ts/monster_test.ts +++ b/tests/ts/monster_test.ts @@ -2,5 +2,5 @@ /* 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 {TableA, TableAT} from './table-a.js'; export * as MyGame from './my-game.js'; diff --git a/tests/ts/my-game.ts b/tests/ts/my-game.ts index 1ea9de7fc..2361a6ae1 100644 --- a/tests/ts/my-game.ts +++ b/tests/ts/my-game.ts @@ -2,7 +2,7 @@ /* 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 {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'; export * as OtherNameSpace from './my-game/other-name-space.js'; diff --git a/tests/ts/my-game/example.ts b/tests/ts/my-game/example.ts index c12c27951..e8a69c4a8 100644 --- a/tests/ts/my-game/example.ts +++ b/tests/ts/my-game/example.ts @@ -2,19 +2,19 @@ /* 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'; -export { AnyUniqueAliases } from './example/any-unique-aliases.js'; -export { Color } from './example/color.js'; -export { LongEnum } from './example/long-enum.js'; -export { Monster, MonsterT } from './example/monster.js'; -export { Race } from './example/race.js'; -export { Referrable, ReferrableT } from './example/referrable.js'; -export { Stat, StatT } from './example/stat.js'; -export { StructOfStructs, StructOfStructsT } from './example/struct-of-structs.js'; -export { StructOfStructsOfStructs, StructOfStructsOfStructsT } from './example/struct-of-structs-of-structs.js'; -export { Test, TestT } from './example/test.js'; -export { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './example/test-simple-table-with-enum.js'; -export { TypeAliases, TypeAliasesT } from './example/type-aliases.js'; -export { Vec3, Vec3T } from './example/vec3.js'; +export {Ability, AbilityT} from './example/ability.js'; +export {Any} from './example/any.js'; +export {AnyAmbiguousAliases} from './example/any-ambiguous-aliases.js'; +export {AnyUniqueAliases} from './example/any-unique-aliases.js'; +export {Color} from './example/color.js'; +export {LongEnum} from './example/long-enum.js'; +export {Monster, MonsterT} from './example/monster.js'; +export {Race} from './example/race.js'; +export {Referrable, ReferrableT} from './example/referrable.js'; +export {Stat, StatT} from './example/stat.js'; +export {StructOfStructs, StructOfStructsT} from './example/struct-of-structs.js'; +export {StructOfStructsOfStructs, StructOfStructsOfStructsT} from './example/struct-of-structs-of-structs.js'; +export {Test, TestT} from './example/test.js'; +export {TestSimpleTableWithEnum, TestSimpleTableWithEnumT} from './example/test-simple-table-with-enum.js'; +export {TypeAliases, TypeAliasesT} from './example/type-aliases.js'; +export {Vec3, Vec3T} from './example/vec3.js'; diff --git a/tests/ts/my-game/example2.ts b/tests/ts/my-game/example2.ts index 5028bba20..5970f4628 100644 --- a/tests/ts/my-game/example2.ts +++ b/tests/ts/my-game/example2.ts @@ -2,4 +2,4 @@ /* 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'; +export {Monster, MonsterT} from './example2/monster.js'; diff --git a/tests/ts/my-game/other-name-space.ts b/tests/ts/my-game/other-name-space.ts index b8ddf7531..2dd5ec081 100644 --- a/tests/ts/my-game/other-name-space.ts +++ b/tests/ts/my-game/other-name-space.ts @@ -2,6 +2,6 @@ /* 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'; +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/no_import_ext/optional-scalars.ts b/tests/ts/no_import_ext/optional-scalars.ts index 8fef7025a..e99c0508a 100644 --- a/tests/ts/no_import_ext/optional-scalars.ts +++ b/tests/ts/no_import_ext/optional-scalars.ts @@ -2,5 +2,5 @@ /* 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'; +export {OptionalByte} from './optional-scalars/optional-byte'; +export {ScalarStuff} from './optional-scalars/scalar-stuff'; diff --git a/tests/ts/non_zero_enum.ts b/tests/ts/non_zero_enum.ts index e3897252f..060f107af 100644 --- a/tests/ts/non_zero_enum.ts +++ b/tests/ts/non_zero_enum.ts @@ -2,5 +2,5 @@ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ -export { NonZero } from './non-zero.js'; -export { NonZeroVectorTable, NonZeroVectorTableT } from './non-zero-vector-table.js'; +export {NonZero} from './non-zero.js'; +export {NonZeroVectorTable, NonZeroVectorTableT} from './non-zero-vector-table.js'; diff --git a/tests/ts/optional-scalars.ts b/tests/ts/optional-scalars.ts index 5ee90df78..d388a3755 100644 --- a/tests/ts/optional-scalars.ts +++ b/tests/ts/optional-scalars.ts @@ -2,5 +2,5 @@ /* 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.js'; -export { ScalarStuff } from './optional-scalars/scalar-stuff.js'; +export {OptionalByte} from './optional-scalars/optional-byte.js'; +export {ScalarStuff} from './optional-scalars/scalar-stuff.js'; diff --git a/tests/ts/reflection.ts b/tests/ts/reflection.ts index a43d07d21..e74a59033 100644 --- a/tests/ts/reflection.ts +++ b/tests/ts/reflection.ts @@ -2,15 +2,15 @@ /* 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'; -export { EnumVal, EnumValT } from './reflection/enum-val.js'; -export { Field, FieldT } from './reflection/field.js'; -export { KeyValue, KeyValueT } from './reflection/key-value.js'; -export { Object_ } from './reflection/object.js'; -export { RPCCall, RPCCallT } from './reflection/rpccall.js'; -export { Schema, SchemaT } from './reflection/schema.js'; -export { SchemaFile, SchemaFileT } from './reflection/schema-file.js'; -export { Service, ServiceT } from './reflection/service.js'; -export { Type, TypeT } from './reflection/type.js'; +export {AdvancedFeatures} from './reflection/advanced-features.js'; +export {BaseType} from './reflection/base-type.js'; +export {Enum, EnumT} from './reflection/enum.js'; +export {EnumVal, EnumValT} from './reflection/enum-val.js'; +export {Field, FieldT} from './reflection/field.js'; +export {KeyValue, KeyValueT} from './reflection/key-value.js'; +export {Object_} from './reflection/object.js'; +export {RPCCall, RPCCallT} from './reflection/rpccall.js'; +export {Schema, SchemaT} from './reflection/schema.js'; +export {SchemaFile, SchemaFileT} from './reflection/schema-file.js'; +export {Service, ServiceT} from './reflection/service.js'; +export {Type, TypeT} from './reflection/type.js'; diff --git a/tests/ts/relative_imports/transit/one.ts b/tests/ts/relative_imports/transit/one.ts index faa13bbc7..acd441992 100644 --- a/tests/ts/relative_imports/transit/one.ts +++ b/tests/ts/relative_imports/transit/one.ts @@ -2,4 +2,4 @@ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ -export { Info, InfoT } from './one/info.js'; +export {Info, InfoT} from './one/info.js'; diff --git a/tests/ts/relative_imports/transit/three.ts b/tests/ts/relative_imports/transit/three.ts index 353bf9e80..be660e7da 100644 --- a/tests/ts/relative_imports/transit/three.ts +++ b/tests/ts/relative_imports/transit/three.ts @@ -2,4 +2,4 @@ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ -export { Header, HeaderT } from './three/header.js'; +export {Header, HeaderT} from './three/header.js'; diff --git a/tests/ts/relative_imports/transit/two.ts b/tests/ts/relative_imports/transit/two.ts index 9522eb616..07ffe29ad 100644 --- a/tests/ts/relative_imports/transit/two.ts +++ b/tests/ts/relative_imports/transit/two.ts @@ -2,4 +2,4 @@ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ -export { Identity, IdentityT } from './two/identity.js'; +export {Identity, IdentityT} from './two/identity.js'; diff --git a/tests/ts/ts-undefined-for-optionals/optional-scalars.ts b/tests/ts/ts-undefined-for-optionals/optional-scalars.ts index aba7511a4..3f0b8637a 100644 --- a/tests/ts/ts-undefined-for-optionals/optional-scalars.ts +++ b/tests/ts/ts-undefined-for-optionals/optional-scalars.ts @@ -2,5 +2,5 @@ /* 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.js'; -export { ScalarStuff, ScalarStuffT } from './optional-scalars/scalar-stuff.js'; +export {OptionalByte} from './optional-scalars/optional-byte.js'; +export {ScalarStuff, ScalarStuffT} from './optional-scalars/scalar-stuff.js'; diff --git a/tests/ts/typescript.ts b/tests/ts/typescript.ts index da50d1539..d219c9a4e 100644 --- a/tests/ts/typescript.ts +++ b/tests/ts/typescript.ts @@ -2,5 +2,5 @@ /* 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'; +export {Object_} from './typescript/object.js'; +export {class_} from './typescript/class.js'; diff --git a/tests/ts/union-underlying-type.ts b/tests/ts/union-underlying-type.ts index df14f067f..3125d067a 100644 --- a/tests/ts/union-underlying-type.ts +++ b/tests/ts/union-underlying-type.ts @@ -2,8 +2,8 @@ /* 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'; +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_vector/union_vector.ts b/tests/ts/union_vector/union_vector.ts index d6e0b608e..34558bc90 100644 --- a/tests/ts/union_vector/union_vector.ts +++ b/tests/ts/union_vector/union_vector.ts @@ -2,11 +2,11 @@ /* 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'; -export { FallingTub, FallingTubT } from './falling-tub.js'; -export { Gadget } from './gadget.js'; -export { HandFan, HandFanT } from './hand-fan.js'; -export { Movie, MovieT } from './movie.js'; -export { Rapunzel, RapunzelT } from './rapunzel.js'; +export {Attacker, AttackerT} from './attacker.js'; +export {BookReader, BookReaderT} from './book-reader.js'; +export {Character} from './character.js'; +export {FallingTub, FallingTubT} from './falling-tub.js'; +export {Gadget} from './gadget.js'; +export {HandFan, HandFanT} from './hand-fan.js'; +export {Movie, MovieT} from './movie.js'; +export {Rapunzel, RapunzelT} from './rapunzel.js'; diff --git a/tests/ts/union_vector/union_vector_generated.cjs b/tests/ts/union_vector/union_vector_generated.cjs index 9fc824ec2..57dae906d 100644 --- a/tests/ts/union_vector/union_vector_generated.cjs +++ b/tests/ts/union_vector/union_vector_generated.cjs @@ -47,7 +47,7 @@ __export(union_vector_exports, { }); module.exports = __toCommonJS(union_vector_exports); -// union_vector/attacker.js +// union_vector/attacker.ts var flatbuffers = __toESM(require("flatbuffers"), 1); var Attacker = class _Attacker { constructor() { @@ -97,7 +97,9 @@ var Attacker = class _Attacker { return _Attacker.endAttacker(builder); } unpack() { - return new AttackerT(this.swordAttackDamage()); + return new AttackerT( + this.swordAttackDamage() + ); } unpackTo(_o) { _o.swordAttackDamage = this.swordAttackDamage(); @@ -108,11 +110,14 @@ var AttackerT = class { this.swordAttackDamage = swordAttackDamage; } pack(builder) { - return Attacker.createAttacker(builder, this.swordAttackDamage); + return Attacker.createAttacker( + builder, + this.swordAttackDamage + ); } }; -// union_vector/book-reader.js +// union_vector/book-reader.ts var BookReader = class { constructor() { this.bb = null; @@ -142,7 +147,9 @@ var BookReader = class { return builder.offset(); } unpack() { - return new BookReaderT(this.booksRead()); + return new BookReaderT( + this.booksRead() + ); } unpackTo(_o) { _o.booksRead = this.booksRead(); @@ -153,11 +160,14 @@ var BookReaderT = class { this.booksRead = booksRead; } pack(builder) { - return BookReader.createBookReader(builder, this.booksRead); + return BookReader.createBookReader( + builder, + this.booksRead + ); } }; -// union_vector/rapunzel.js +// union_vector/rapunzel.ts var Rapunzel = class { constructor() { this.bb = null; @@ -187,7 +197,9 @@ var Rapunzel = class { return builder.offset(); } unpack() { - return new RapunzelT(this.hairLength()); + return new RapunzelT( + this.hairLength() + ); } unpackTo(_o) { _o.hairLength = this.hairLength(); @@ -198,13 +210,15 @@ var RapunzelT = class { this.hairLength = hairLength; } pack(builder) { - return Rapunzel.createRapunzel(builder, this.hairLength); + return Rapunzel.createRapunzel( + builder, + this.hairLength + ); } }; -// union_vector/character.js -var Character; -(function(Character2) { +// union_vector/character.ts +var Character = /* @__PURE__ */ ((Character2) => { Character2[Character2["NONE"] = 0] = "NONE"; Character2[Character2["MuLan"] = 1] = "MuLan"; Character2[Character2["Rapunzel"] = 2] = "Rapunzel"; @@ -212,7 +226,8 @@ var Character; Character2[Character2["BookFan"] = 4] = "BookFan"; Character2[Character2["Other"] = 5] = "Other"; Character2[Character2["Unused"] = 6] = "Unused"; -})(Character || (Character = {})); + return Character2; +})(Character || {}); function unionToCharacter(type, accessor) { switch (Character[type]) { case "NONE": @@ -254,7 +269,7 @@ function unionListToCharacter(type, accessor, index) { } } -// union_vector/falling-tub.js +// union_vector/falling-tub.ts var FallingTub = class { constructor() { this.bb = null; @@ -284,7 +299,9 @@ var FallingTub = class { return builder.offset(); } unpack() { - return new FallingTubT(this.weight()); + return new FallingTubT( + this.weight() + ); } unpackTo(_o) { _o.weight = this.weight(); @@ -295,11 +312,14 @@ var FallingTubT = class { this.weight = weight; } pack(builder) { - return FallingTub.createFallingTub(builder, this.weight); + return FallingTub.createFallingTub( + builder, + this.weight + ); } }; -// union_vector/hand-fan.js +// union_vector/hand-fan.ts var flatbuffers2 = __toESM(require("flatbuffers"), 1); var HandFan = class _HandFan { constructor() { @@ -349,7 +369,9 @@ var HandFan = class _HandFan { return _HandFan.endHandFan(builder); } unpack() { - return new HandFanT(this.length()); + return new HandFanT( + this.length() + ); } unpackTo(_o) { _o.length = this.length(); @@ -360,19 +382,22 @@ var HandFanT = class { this.length = length; } pack(builder) { - return HandFan.createHandFan(builder, this.length); + return HandFan.createHandFan( + builder, + this.length + ); } }; -// union_vector/gadget.js -var Gadget; -(function(Gadget2) { +// union_vector/gadget.ts +var Gadget = /* @__PURE__ */ ((Gadget2) => { Gadget2[Gadget2["NONE"] = 0] = "NONE"; Gadget2[Gadget2["FallingTub"] = 1] = "FallingTub"; Gadget2[Gadget2["HandFan"] = 2] = "HandFan"; -})(Gadget || (Gadget = {})); + return Gadget2; +})(Gadget || {}); -// union_vector/movie.js +// union_vector/movie.ts var flatbuffers3 = __toESM(require("flatbuffers"), 1); var Movie = class _Movie { constructor() { @@ -396,7 +421,7 @@ var Movie = class _Movie { } mainCharacterType() { const offset = this.bb.__offset(this.bb_pos, 4); - return offset ? this.bb.readUint8(this.bb_pos + offset) : Character.NONE; + return offset ? this.bb.readUint8(this.bb_pos + offset) : 0 /* NONE */; } mainCharacter(obj) { const offset = this.bb.__offset(this.bb_pos, 6); @@ -429,7 +454,7 @@ var Movie = class _Movie { builder.startObject(4); } static addMainCharacterType(builder, mainCharacterType) { - builder.addFieldInt8(0, mainCharacterType, Character.NONE); + builder.addFieldInt8(0, mainCharacterType, 0 /* NONE */); } static addMainCharacter(builder, mainCharacterOffset) { builder.addFieldOffset(1, mainCharacterOffset, 0); @@ -479,34 +504,39 @@ var Movie = class _Movie { return _Movie.endMovie(builder); } unpack() { - return new MovieT(this.mainCharacterType(), (() => { - const temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this)); - if (temp === null) { - return null; - } - if (typeof temp === "string") { - return temp; - } - return temp.unpack(); - })(), this.bb.createScalarList(this.charactersType.bind(this), this.charactersTypeLength()), (() => { - const ret = []; - for (let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) { - const targetEnum = this.charactersType(targetEnumIndex); - if (targetEnum === null || Character[targetEnum] === "NONE") { - continue; - } - const temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex); + return new MovieT( + this.mainCharacterType(), + (() => { + const temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this)); if (temp === null) { - continue; + return null; } if (typeof temp === "string") { - ret.push(temp); - continue; + return temp; } - ret.push(temp.unpack()); - } - return ret; - })()); + return temp.unpack(); + })(), + this.bb.createScalarList(this.charactersType.bind(this), this.charactersTypeLength()), + (() => { + const ret = []; + for (let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) { + const targetEnum = this.charactersType(targetEnumIndex); + if (targetEnum === null || Character[targetEnum] === "NONE") { + continue; + } + const temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex); + if (temp === null) { + continue; + } + if (typeof temp === "string") { + ret.push(temp); + continue; + } + ret.push(temp.unpack()); + } + return ret; + })() + ); } unpackTo(_o) { _o.mainCharacterType = this.mainCharacterType(); @@ -543,7 +573,7 @@ var Movie = class _Movie { } }; var MovieT = class { - constructor(mainCharacterType = Character.NONE, mainCharacter = null, charactersType = [], characters = []) { + constructor(mainCharacterType = 0 /* NONE */, mainCharacter = null, charactersType = [], characters = []) { this.mainCharacterType = mainCharacterType; this.mainCharacter = mainCharacter; this.charactersType = charactersType; @@ -553,6 +583,12 @@ var MovieT = class { const mainCharacter = builder.createObjectOffset(this.mainCharacter); const charactersType = Movie.createCharactersTypeVector(builder, this.charactersType); const characters = Movie.createCharactersVector(builder, builder.createObjectOffsetList(this.characters)); - return Movie.createMovie(builder, this.mainCharacterType, mainCharacter, charactersType, characters); + return Movie.createMovie( + builder, + this.mainCharacterType, + mainCharacter, + charactersType, + characters + ); } };