mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-28 14:00:02 +00:00
* [TS] Add support for fixed length arrays on Typescript (#5864) (#7021) * Typescript / Javascript don't have fixed arrays but it is important to support these languages for compatibility. * Generated TS code checks the length of the given array and do truncating / padding to conform to the schema. * Supports the both standard API and Object Based API. * Added a test. Co-authored-by: Mehmet Baker <mehmet.baker@zerodensity.tv> Signed-off-by: Bulent Vural <bulent.vural@zerodensity.tv> Signed-off-by: Bülent Vural <bulent.vural@zerodensity.tv> * Formatting & readability fixes on idl_gen_ts.cpp Signed-off-by: Bülent Vural <bulent.vural@zerodensity.tv> * Added array_test_complex.bfbs Signed-off-by: Bülent Vural <bulent.vural@zerodensity.tv> * TS arrays_test_complex: Remove bfbs and use fbs directly Signed-off-by: Bülent Vural <bulent.vural@zerodensity.tv> Signed-off-by: Bülent Vural <bulent.vural@zerodensity.tv>
This commit is contained in:
@@ -146,7 +146,7 @@ unpack(): MovieT {
|
||||
})(),
|
||||
this.bb!.createScalarList<Character>(this.charactersType.bind(this), this.charactersTypeLength()),
|
||||
(() => {
|
||||
const ret = [];
|
||||
const ret: (AttackerT|BookReaderT|RapunzelT|string)[] = [];
|
||||
for(let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) {
|
||||
const targetEnum = this.charactersType(targetEnumIndex);
|
||||
if(targetEnum === null || Character[targetEnum!] === 'NONE') { continue; }
|
||||
@@ -172,7 +172,7 @@ unpackTo(_o: MovieT): void {
|
||||
})();
|
||||
_o.charactersType = this.bb!.createScalarList<Character>(this.charactersType.bind(this), this.charactersTypeLength());
|
||||
_o.characters = (() => {
|
||||
const ret = [];
|
||||
const ret: (AttackerT|BookReaderT|RapunzelT|string)[] = [];
|
||||
for(let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) {
|
||||
const targetEnum = this.charactersType(targetEnumIndex);
|
||||
if(targetEnum === null || Character[targetEnum!] === 'NONE') { continue; }
|
||||
|
||||
Reference in New Issue
Block a user