flatbuffers icon indicating copy to clipboard operation
flatbuffers copied to clipboard

[TS] wrong code generation for colliding type names and non root_type

Open tira-misu opened this issue 9 months ago • 0 comments

If you use same type name in different namespaces and use them in a non root_type, flatc will generate wrong code. Minimal example:

namespace foo;

table MyType {
  value :uint32;
}

namespace bar;

table MyType {
  value : foo.MyType;
}

table zz {
}

root_type zz;

Code for bar.MyType will not compile. Name clash of MyType will not be detected. Fix is to always do the special case for root structs: https://github.com/google/flatbuffers/blob/master/src/idl_gen_ts.cpp#L1560

tira-misu avatar May 08 '25 11:05 tira-misu