mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-05 17:06:52 +00:00
Improve TS types to support isolatedModules and isolatedDeclarations
This commit is contained in:
78
tests/ts/relative_imports/transit/two/identity.ts
Normal file
78
tests/ts/relative_imports/transit/two/identity.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 Identity implements flatbuffers.IUnpackableObject<IdentityT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos: number = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Identity {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsIdentity(bb:flatbuffers.ByteBuffer, obj?:Identity):Identity {
|
||||
return (obj || new Identity()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsIdentity(bb:flatbuffers.ByteBuffer, obj?:Identity):Identity {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new Identity()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
id():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static getFullyQualifiedName(): "Transit.Two.Identity" {
|
||||
return 'Transit.Two.Identity';
|
||||
}
|
||||
|
||||
static startIdentity(builder:flatbuffers.Builder):void {
|
||||
builder.startObject(1);
|
||||
}
|
||||
|
||||
static addId(builder:flatbuffers.Builder, id:number):void {
|
||||
builder.addFieldInt32(0, id, 0);
|
||||
}
|
||||
|
||||
static endIdentity(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createIdentity(builder:flatbuffers.Builder, id:number):flatbuffers.Offset {
|
||||
Identity.startIdentity(builder);
|
||||
Identity.addId(builder, id);
|
||||
return Identity.endIdentity(builder);
|
||||
}
|
||||
|
||||
unpack(): IdentityT {
|
||||
return new IdentityT(
|
||||
this.id()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: IdentityT): void {
|
||||
_o.id = this.id();
|
||||
}
|
||||
}
|
||||
|
||||
export class IdentityT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public id: number = 0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return Identity.createIdentity(builder,
|
||||
this.id
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user