mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-04 10:21:10 +00:00
Improve TS types to support isolatedModules and isolatedDeclarations
This commit is contained in:
1
tests/ts/relative_imports/transit/one.d.ts
vendored
Normal file
1
tests/ts/relative_imports/transit/one.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { Info, InfoT } from './one/info.js';
|
||||
3
tests/ts/relative_imports/transit/one.js
Normal file
3
tests/ts/relative_imports/transit/one.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// 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 */
|
||||
export { Info, InfoT } from './one/info.js';
|
||||
5
tests/ts/relative_imports/transit/one.ts
Normal file
5
tests/ts/relative_imports/transit/one.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// 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 */
|
||||
|
||||
export { Info, InfoT } from './one/info.js';
|
||||
21
tests/ts/relative_imports/transit/one/info.d.ts
vendored
Normal file
21
tests/ts/relative_imports/transit/one/info.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export declare class Info implements flatbuffers.IUnpackableObject<InfoT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): Info;
|
||||
static getRootAsInfo(bb: flatbuffers.ByteBuffer, obj?: Info): Info;
|
||||
static getSizePrefixedRootAsInfo(bb: flatbuffers.ByteBuffer, obj?: Info): Info;
|
||||
timestamp(): bigint;
|
||||
static getFullyQualifiedName(): "Transit.One.Info";
|
||||
static startInfo(builder: flatbuffers.Builder): void;
|
||||
static addTimestamp(builder: flatbuffers.Builder, timestamp: bigint): void;
|
||||
static endInfo(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
static createInfo(builder: flatbuffers.Builder, timestamp: bigint): flatbuffers.Offset;
|
||||
unpack(): InfoT;
|
||||
unpackTo(_o: InfoT): void;
|
||||
}
|
||||
export declare class InfoT implements flatbuffers.IGeneratedObject {
|
||||
timestamp: bigint;
|
||||
constructor(timestamp?: bigint);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
57
tests/ts/relative_imports/transit/one/info.js
Normal file
57
tests/ts/relative_imports/transit/one/info.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 Info {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
static getRootAsInfo(bb, obj) {
|
||||
return (obj || new Info()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static getSizePrefixedRootAsInfo(bb, obj) {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new Info()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
timestamp() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'Transit.One.Info';
|
||||
}
|
||||
static startInfo(builder) {
|
||||
builder.startObject(1);
|
||||
}
|
||||
static addTimestamp(builder, timestamp) {
|
||||
builder.addFieldInt64(0, timestamp, BigInt('0'));
|
||||
}
|
||||
static endInfo(builder) {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
static createInfo(builder, timestamp) {
|
||||
Info.startInfo(builder);
|
||||
Info.addTimestamp(builder, timestamp);
|
||||
return Info.endInfo(builder);
|
||||
}
|
||||
unpack() {
|
||||
return new InfoT(this.timestamp());
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.timestamp = this.timestamp();
|
||||
}
|
||||
}
|
||||
export class InfoT {
|
||||
constructor(timestamp = BigInt('0')) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
pack(builder) {
|
||||
return Info.createInfo(builder, this.timestamp);
|
||||
}
|
||||
}
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
1
tests/ts/relative_imports/transit/three.d.ts
vendored
Normal file
1
tests/ts/relative_imports/transit/three.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { Header, HeaderT } from './three/header.js';
|
||||
3
tests/ts/relative_imports/transit/three.js
Normal file
3
tests/ts/relative_imports/transit/three.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// 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 */
|
||||
export { Header, HeaderT } from './three/header.js';
|
||||
5
tests/ts/relative_imports/transit/three.ts
Normal file
5
tests/ts/relative_imports/transit/three.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// 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 */
|
||||
|
||||
export { Header, HeaderT } from './three/header.js';
|
||||
27
tests/ts/relative_imports/transit/three/header.d.ts
vendored
Normal file
27
tests/ts/relative_imports/transit/three/header.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { Info, InfoT } from '../one/info.js';
|
||||
import { Identity, IdentityT } from '../two/identity.js';
|
||||
export declare class Header implements flatbuffers.IUnpackableObject<HeaderT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): Header;
|
||||
static getRootAsHeader(bb: flatbuffers.ByteBuffer, obj?: Header): Header;
|
||||
static getSizePrefixedRootAsHeader(bb: flatbuffers.ByteBuffer, obj?: Header): Header;
|
||||
info(obj?: Info): Info | null;
|
||||
id(obj?: Identity): Identity | null;
|
||||
static getFullyQualifiedName(): "Transit.Three.Header";
|
||||
static startHeader(builder: flatbuffers.Builder): void;
|
||||
static addInfo(builder: flatbuffers.Builder, infoOffset: flatbuffers.Offset): void;
|
||||
static addId(builder: flatbuffers.Builder, idOffset: flatbuffers.Offset): void;
|
||||
static endHeader(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
static finishHeaderBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
|
||||
static finishSizePrefixedHeaderBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
|
||||
unpack(): HeaderT;
|
||||
unpackTo(_o: HeaderT): void;
|
||||
}
|
||||
export declare class HeaderT implements flatbuffers.IGeneratedObject {
|
||||
info: InfoT | null;
|
||||
id: IdentityT | null;
|
||||
constructor(info?: InfoT | null, id?: IdentityT | null);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
74
tests/ts/relative_imports/transit/three/header.js
Normal file
74
tests/ts/relative_imports/transit/three/header.js
Normal file
@@ -0,0 +1,74 @@
|
||||
// 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';
|
||||
import { Info } from '../one/info.js';
|
||||
import { Identity } from '../two/identity.js';
|
||||
export class Header {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
static getRootAsHeader(bb, obj) {
|
||||
return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static getSizePrefixedRootAsHeader(bb, obj) {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
info(obj) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? (obj || new Info()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
|
||||
}
|
||||
id(obj) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new Identity()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'Transit.Three.Header';
|
||||
}
|
||||
static startHeader(builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
static addInfo(builder, infoOffset) {
|
||||
builder.addFieldOffset(0, infoOffset, 0);
|
||||
}
|
||||
static addId(builder, idOffset) {
|
||||
builder.addFieldOffset(1, idOffset, 0);
|
||||
}
|
||||
static endHeader(builder) {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
static finishHeaderBuffer(builder, offset) {
|
||||
builder.finish(offset);
|
||||
}
|
||||
static finishSizePrefixedHeaderBuffer(builder, offset) {
|
||||
builder.finish(offset, undefined, true);
|
||||
}
|
||||
unpack() {
|
||||
return new HeaderT((this.info() !== null ? this.info().unpack() : null), (this.id() !== null ? this.id().unpack() : null));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.info = (this.info() !== null ? this.info().unpack() : null);
|
||||
_o.id = (this.id() !== null ? this.id().unpack() : null);
|
||||
}
|
||||
}
|
||||
export class HeaderT {
|
||||
constructor(info = null, id = null) {
|
||||
this.info = info;
|
||||
this.id = id;
|
||||
}
|
||||
pack(builder) {
|
||||
const info = (this.info !== null ? this.info.pack(builder) : 0);
|
||||
const id = (this.id !== null ? this.id.pack(builder) : 0);
|
||||
Header.startHeader(builder);
|
||||
Header.addInfo(builder, info);
|
||||
Header.addId(builder, id);
|
||||
return Header.endHeader(builder);
|
||||
}
|
||||
}
|
||||
100
tests/ts/relative_imports/transit/three/header.ts
Normal file
100
tests/ts/relative_imports/transit/three/header.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
// 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';
|
||||
|
||||
import { Info, InfoT } from '../one/info.js';
|
||||
import { Identity, IdentityT } from '../two/identity.js';
|
||||
|
||||
|
||||
export class Header implements flatbuffers.IUnpackableObject<HeaderT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos: number = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Header {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsHeader(bb:flatbuffers.ByteBuffer, obj?:Header):Header {
|
||||
return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsHeader(bb:flatbuffers.ByteBuffer, obj?:Header):Header {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
info(obj?:Info):Info|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? (obj || new Info()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
|
||||
}
|
||||
|
||||
id(obj?:Identity):Identity|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new Identity()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
|
||||
}
|
||||
|
||||
static getFullyQualifiedName(): "Transit.Three.Header" {
|
||||
return 'Transit.Three.Header';
|
||||
}
|
||||
|
||||
static startHeader(builder:flatbuffers.Builder):void {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addInfo(builder:flatbuffers.Builder, infoOffset:flatbuffers.Offset):void {
|
||||
builder.addFieldOffset(0, infoOffset, 0);
|
||||
}
|
||||
|
||||
static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset):void {
|
||||
builder.addFieldOffset(1, idOffset, 0);
|
||||
}
|
||||
|
||||
static endHeader(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static finishHeaderBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset):void {
|
||||
builder.finish(offset);
|
||||
}
|
||||
|
||||
static finishSizePrefixedHeaderBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset):void {
|
||||
builder.finish(offset, undefined, true);
|
||||
}
|
||||
|
||||
|
||||
unpack(): HeaderT {
|
||||
return new HeaderT(
|
||||
(this.info() !== null ? this.info()!.unpack() : null),
|
||||
(this.id() !== null ? this.id()!.unpack() : null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: HeaderT): void {
|
||||
_o.info = (this.info() !== null ? this.info()!.unpack() : null);
|
||||
_o.id = (this.id() !== null ? this.id()!.unpack() : null);
|
||||
}
|
||||
}
|
||||
|
||||
export class HeaderT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public info: InfoT|null = null,
|
||||
public id: IdentityT|null = null
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const info = (this.info !== null ? this.info!.pack(builder) : 0);
|
||||
const id = (this.id !== null ? this.id!.pack(builder) : 0);
|
||||
|
||||
Header.startHeader(builder);
|
||||
Header.addInfo(builder, info);
|
||||
Header.addId(builder, id);
|
||||
|
||||
return Header.endHeader(builder);
|
||||
}
|
||||
}
|
||||
1
tests/ts/relative_imports/transit/two.d.ts
vendored
Normal file
1
tests/ts/relative_imports/transit/two.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { Identity, IdentityT } from './two/identity.js';
|
||||
3
tests/ts/relative_imports/transit/two.js
Normal file
3
tests/ts/relative_imports/transit/two.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// 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 */
|
||||
export { Identity, IdentityT } from './two/identity.js';
|
||||
5
tests/ts/relative_imports/transit/two.ts
Normal file
5
tests/ts/relative_imports/transit/two.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// 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 */
|
||||
|
||||
export { Identity, IdentityT } from './two/identity.js';
|
||||
21
tests/ts/relative_imports/transit/two/identity.d.ts
vendored
Normal file
21
tests/ts/relative_imports/transit/two/identity.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export declare class Identity implements flatbuffers.IUnpackableObject<IdentityT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): Identity;
|
||||
static getRootAsIdentity(bb: flatbuffers.ByteBuffer, obj?: Identity): Identity;
|
||||
static getSizePrefixedRootAsIdentity(bb: flatbuffers.ByteBuffer, obj?: Identity): Identity;
|
||||
id(): number;
|
||||
static getFullyQualifiedName(): "Transit.Two.Identity";
|
||||
static startIdentity(builder: flatbuffers.Builder): void;
|
||||
static addId(builder: flatbuffers.Builder, id: number): void;
|
||||
static endIdentity(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
static createIdentity(builder: flatbuffers.Builder, id: number): flatbuffers.Offset;
|
||||
unpack(): IdentityT;
|
||||
unpackTo(_o: IdentityT): void;
|
||||
}
|
||||
export declare class IdentityT implements flatbuffers.IGeneratedObject {
|
||||
id: number;
|
||||
constructor(id?: number);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
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