mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-06 00:36:55 +00:00
Improve TS types to support isolatedModules and isolatedDeclarations
This commit is contained in:
78
tests/ts/relative_imports/transit/one/info.ts
Normal file
78
tests/ts/relative_imports/transit/one/info.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
// 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 Info implements flatbuffers.IUnpackableObject<InfoT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos: number = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Info {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsInfo(bb:flatbuffers.ByteBuffer, obj?:Info):Info {
|
||||
return (obj || new Info()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsInfo(bb:flatbuffers.ByteBuffer, obj?:Info):Info {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new Info()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
timestamp():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
static getFullyQualifiedName(): "Transit.One.Info" {
|
||||
return 'Transit.One.Info';
|
||||
}
|
||||
|
||||
static startInfo(builder:flatbuffers.Builder):void {
|
||||
builder.startObject(1);
|
||||
}
|
||||
|
||||
static addTimestamp(builder:flatbuffers.Builder, timestamp:bigint):void {
|
||||
builder.addFieldInt64(0, timestamp, BigInt('0'));
|
||||
}
|
||||
|
||||
static endInfo(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createInfo(builder:flatbuffers.Builder, timestamp:bigint):flatbuffers.Offset {
|
||||
Info.startInfo(builder);
|
||||
Info.addTimestamp(builder, timestamp);
|
||||
return Info.endInfo(builder);
|
||||
}
|
||||
|
||||
unpack(): InfoT {
|
||||
return new InfoT(
|
||||
this.timestamp()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: InfoT): void {
|
||||
_o.timestamp = this.timestamp();
|
||||
}
|
||||
}
|
||||
|
||||
export class InfoT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public timestamp: bigint = BigInt('0')
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return Info.createInfo(builder,
|
||||
this.timestamp
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user