Files
flatbuffers/tests/namespace_test/namespace-a/namespace-b/union-in-nested-n-s.ts
Kamil Rojewski 4033ff5892 fixed invalid TS call and added test files (#6495)
e581013e3d broke TS generation - please don't use "replace" to refactor function names :)
2021-03-04 12:12:44 -08:00

34 lines
957 B
TypeScript

// automatically generated by the FlatBuffers compiler, do not modify
import { TableInNestedNS, TableInNestedNST } from '../../namespace-a/namespace-b/table-in-nested-n-s';
export enum UnionInNestedNS{
NONE = 0,
TableInNestedNS = 1
}
export function unionToUnionInNestedNS(
type: UnionInNestedNS,
accessor: (obj:TableInNestedNS) => TableInNestedNS|null
): TableInNestedNS|null {
switch(UnionInNestedNS[type]) {
case 'NONE': return null;
case 'TableInNestedNS': return accessor(new TableInNestedNS())! as TableInNestedNS;
default: return null;
}
}
export function unionListToUnionInNestedNS(
type: UnionInNestedNS,
accessor: (index: number, obj:TableInNestedNS) => TableInNestedNS|null,
index: number
): TableInNestedNS|null {
switch(UnionInNestedNS[type]) {
case 'NONE': return null;
case 'TableInNestedNS': return accessor(index, new TableInNestedNS())! as TableInNestedNS;
default: return null;
}
}