mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-05 12:37:05 +00:00
Improve TS types to support isolatedModules and isolatedDeclarations
This commit is contained in:
57
tests/ts/relative_imports/transit/two/identity.js
Normal file
57
tests/ts/relative_imports/transit/two/identity.js
Normal file
@@ -0,0 +1,57 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export class Identity {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
static getRootAsIdentity(bb, obj) {
|
||||
return (obj || new Identity()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static getSizePrefixedRootAsIdentity(bb, obj) {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new Identity()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
id() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'Transit.Two.Identity';
|
||||
}
|
||||
static startIdentity(builder) {
|
||||
builder.startObject(1);
|
||||
}
|
||||
static addId(builder, id) {
|
||||
builder.addFieldInt32(0, id, 0);
|
||||
}
|
||||
static endIdentity(builder) {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
static createIdentity(builder, id) {
|
||||
Identity.startIdentity(builder);
|
||||
Identity.addId(builder, id);
|
||||
return Identity.endIdentity(builder);
|
||||
}
|
||||
unpack() {
|
||||
return new IdentityT(this.id());
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.id = this.id();
|
||||
}
|
||||
}
|
||||
export class IdentityT {
|
||||
constructor(id = 0) {
|
||||
this.id = id;
|
||||
}
|
||||
pack(builder) {
|
||||
return Identity.createIdentity(builder, this.id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user