mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-12 07:50:59 +00:00
Generating the most strict TS code possible (#4286)
* Eclipse ignore * TypeScript support * Prefixing enums * Test results * Merged JS and TS generators * Fixed AppVeyor build problems * Fixed more AppVeyor build problems * Fixed more AppVeyor build problems * Changed TS flag to options struct * Storing options by value * Removed unneeded const * Re-export support for unions * Uint support * Casting bools to numbers for mutation * TS shell tests * Reverted generates js test file to original version * Backing up js tests and properly generating test data * Not importing flatbuffers for TS test generation * Not overwriting generated js for tests * AppVeyor test fixes * Generating the most strict TS code possible
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
8b92122f33
commit
86777bd66b
@@ -18,6 +18,6 @@ pushd "$(dirname $0)" >/dev/null
|
||||
../flatc --ts --no-fb-import --gen-mutable -o ts monster_test.fbs
|
||||
../flatc -b monster_test.fbs unicode_test.json
|
||||
npm install @types/flatbuffers
|
||||
tsc ts/monster_test_generated.ts
|
||||
tsc --strict --noUnusedParameters --noUnusedLocals --noImplicitReturns --strictNullChecks ts/monster_test_generated.ts
|
||||
npm uninstall @types/flatbuffers
|
||||
node JavaScriptTest ./ts/monster_test_generated
|
||||
|
||||
@@ -50,7 +50,7 @@ MyGame.Example2.Monster = function() {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
this.bb = null;
|
||||
this.bb = undefined;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -101,7 +101,7 @@ MyGame.Example.Test = function() {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
this.bb = null;
|
||||
this.bb = undefined;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -185,7 +185,7 @@ MyGame.Example.TestSimpleTableWithEnum = function() {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
this.bb = null;
|
||||
this.bb = undefined;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -267,7 +267,7 @@ MyGame.Example.Vec3 = function() {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
this.bb = null;
|
||||
this.bb = undefined;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -439,7 +439,7 @@ MyGame.Example.Ability = function() {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
this.bb = null;
|
||||
this.bb = undefined;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -522,7 +522,7 @@ MyGame.Example.Stat = function() {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
this.bb = null;
|
||||
this.bb = undefined;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -552,7 +552,7 @@ MyGame.Example.Stat.getRootAsStat = function(bb, obj) {
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Encoding=} optionalEncoding
|
||||
* @returns {string|Uint8Array}
|
||||
* @returns {string|Uint8Array|null}
|
||||
*/
|
||||
MyGame.Example.Stat.prototype.id = function(optionalEncoding) {
|
||||
var offset = this.bb.__offset(this.bb_pos, 4);
|
||||
@@ -654,7 +654,7 @@ MyGame.Example.Monster = function() {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
this.bb = null;
|
||||
this.bb = undefined;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -747,7 +747,7 @@ MyGame.Example.Monster.prototype.mutate_hp = function(value) {
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Encoding=} optionalEncoding
|
||||
* @returns {string|Uint8Array}
|
||||
* @returns {string|Uint8Array|null}
|
||||
*/
|
||||
MyGame.Example.Monster.prototype.name = function(optionalEncoding) {
|
||||
var offset = this.bb.__offset(this.bb_pos, 10);
|
||||
|
||||
@@ -29,7 +29,7 @@ export class Monster {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -81,7 +81,7 @@ export class Test {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -166,7 +166,7 @@ export class TestSimpleTableWithEnum {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -249,7 +249,7 @@ export class Vec3 {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -422,7 +422,7 @@ export class Ability {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -506,7 +506,7 @@ export class Stat {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -534,10 +534,10 @@ static getRootAsStat(bb:flatbuffers.ByteBuffer, obj?:Stat):Stat {
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Encoding=} optionalEncoding
|
||||
* @returns {string|Uint8Array}
|
||||
* @returns {string|Uint8Array|null}
|
||||
*/
|
||||
id():string
|
||||
id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array
|
||||
id():string|null
|
||||
id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
id(optionalEncoding?:any):string|Uint8Array {
|
||||
var offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
@@ -641,7 +641,7 @@ export class Monster {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -732,10 +732,10 @@ mutate_hp(value:number):boolean {
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Encoding=} optionalEncoding
|
||||
* @returns {string|Uint8Array}
|
||||
* @returns {string|Uint8Array|null}
|
||||
*/
|
||||
name():string
|
||||
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array
|
||||
name():string|null
|
||||
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
name(optionalEncoding?:any):string|Uint8Array {
|
||||
var offset = this.bb.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
|
||||
@@ -28,7 +28,7 @@ NamespaceA.NamespaceB.TableInNestedNS = function() {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
this.bb = null;
|
||||
this.bb = undefined;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -110,7 +110,7 @@ NamespaceA.NamespaceB.StructInNestedNS = function() {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
this.bb = null;
|
||||
this.bb = undefined;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
|
||||
@@ -18,7 +18,7 @@ export class TableInNestedNS {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -101,7 +101,7 @@ export class StructInNestedNS {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
|
||||
@@ -25,7 +25,7 @@ NamespaceA.TableInFirstNS = function() {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
this.bb = null;
|
||||
this.bb = undefined;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -141,7 +141,7 @@ NamespaceC.TableInC = function() {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
this.bb = null;
|
||||
this.bb = undefined;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -226,7 +226,7 @@ NamespaceA.SecondTableInA = function() {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
this.bb = null;
|
||||
this.bb = undefined;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
|
||||
@@ -9,7 +9,7 @@ export class TableInFirstNS {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -126,7 +126,7 @@ export class TableInC {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
@@ -212,7 +212,7 @@ export class SecondTableInA {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
|
||||
Reference in New Issue
Block a user