mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-28 23:20:02 +00:00
[TS/JS] Move TS tests to dedicated folder and deps upgrade (#7508)
* Move TS tests to dedicated folder and deps upgrade * Attempt to fix generate_code * Fix dir on CI * Add js extension * Fix missing extension * Harmonize with test gen * Unexplained code gen change * Restore yarn.lock * Naive attempt to fix bazel stuff * Pin @bazel/typescript to 5.2.0 * Attempt to fix bazel * More tweak * Upgrade deps * Tweak? * Fix path * Fix test package Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
25
tests/ts/union_vector/gadget.js
Normal file
25
tests/ts/union_vector/gadget.js
Normal file
@@ -0,0 +1,25 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import { FallingTub } from './falling-tub.js';
|
||||
import { HandFan } from './hand-fan.js';
|
||||
export var Gadget;
|
||||
(function (Gadget) {
|
||||
Gadget[Gadget["NONE"] = 0] = "NONE";
|
||||
Gadget[Gadget["FallingTub"] = 1] = "FallingTub";
|
||||
Gadget[Gadget["HandFan"] = 2] = "HandFan";
|
||||
})(Gadget || (Gadget = {}));
|
||||
export function unionToGadget(type, accessor) {
|
||||
switch (Gadget[type]) {
|
||||
case 'NONE': return null;
|
||||
case 'FallingTub': return accessor(new FallingTub());
|
||||
case 'HandFan': return accessor(new HandFan());
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
export function unionListToGadget(type, accessor, index) {
|
||||
switch (Gadget[type]) {
|
||||
case 'NONE': return null;
|
||||
case 'FallingTub': return accessor(index, new FallingTub());
|
||||
case 'HandFan': return accessor(index, new HandFan());
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user