diff options
Diffstat (limited to 'tests/my-game/example/any-ambiguous-aliases.ts')
-rw-r--r-- | tests/my-game/example/any-ambiguous-aliases.ts | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/my-game/example/any-ambiguous-aliases.ts b/tests/my-game/example/any-ambiguous-aliases.ts new file mode 100644 index 00000000..6687a419 --- /dev/null +++ b/tests/my-game/example/any-ambiguous-aliases.ts @@ -0,0 +1,39 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +import { Monster, MonsterT } from '../../my-game/example/monster'; + + +export enum AnyAmbiguousAliases{ + NONE = 0, + M1 = 1, + M2 = 2, + M3 = 3 +} + +export function unionToAnyAmbiguousAliases( + type: AnyAmbiguousAliases, + accessor: (obj:Monster) => Monster|null +): Monster|null { + switch(AnyAmbiguousAliases[type]) { + case 'NONE': return null; + case 'M1': return accessor(new Monster())! as Monster; + case 'M2': return accessor(new Monster())! as Monster; + case 'M3': return accessor(new Monster())! as Monster; + default: return null; + } +} + +export function unionListToAnyAmbiguousAliases( + type: AnyAmbiguousAliases, + accessor: (index: number, obj:Monster) => Monster|null, + index: number +): Monster|null { + switch(AnyAmbiguousAliases[type]) { + case 'NONE': return null; + case 'M1': return accessor(index, new Monster())! as Monster; + case 'M2': return accessor(index, new Monster())! as Monster; + case 'M3': return accessor(index, new Monster())! as Monster; + default: return null; + } +} + |