Debian Codegraph @

tests/ts/my-game/example/any.js

raw
1 // automatically generated by the FlatBuffers compiler, do not modify
2 /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
3 import { Monster as MyGame_Example2_Monster } from '../../my-game/example2/monster.js';
4 import { Monster } from '../../my-game/example/monster.js';
5 import { TestSimpleTableWithEnum } from '../../my-game/example/test-simple-table-with-enum.js';
6 export var Any;
7 (function (Any) {
8 Any[Any["NONE"] = 0] = "NONE";
9 Any[Any["Monster"] = 1] = "Monster";
10 Any[Any["TestSimpleTableWithEnum"] = 2] = "TestSimpleTableWithEnum";
11 Any[Any["MyGame_Example2_Monster"] = 3] = "MyGame_Example2_Monster";
12 })(Any || (Any = {}));
13 export function unionToAny(type, accessor) {
14 switch (Any[type]) {
15 case 'NONE': return null;
16 case 'Monster': return accessor(new Monster());
17 case 'TestSimpleTableWithEnum': return accessor(new TestSimpleTableWithEnum());
18 case 'MyGame_Example2_Monster': return accessor(new MyGame_Example2_Monster());
19 default: return null;
20 }
21 }
22 export function unionListToAny(type, accessor, index) {
23 switch (Any[type]) {
24 case 'NONE': return null;
25 case 'Monster': return accessor(index, new Monster());
26 case 'TestSimpleTableWithEnum': return accessor(index, new TestSimpleTableWithEnum());
27 case 'MyGame_Example2_Monster': return accessor(index, new MyGame_Example2_Monster());
28 default: return null;
29 }
30 }