[TS] Fix four bugs with imported types in TypeScript. (#6054)
authorMax Burke <max@urbanlogiq.com>
Mon, 3 Aug 2020 19:08:52 +0000 (12:08 -0700)
committerGitHub <noreply@github.com>
Mon, 3 Aug 2020 19:08:52 +0000 (12:08 -0700)
commitc30a87de6fc741d7dfcf1f721a69d89ca27a0866
treedaf3dd811ee7ce90775fc01c88a6055af654bacf
parenta0fb30575c2425512ebc2757910d106e15114b58
[TS] Fix four bugs with imported types in TypeScript. (#6054)

* [TS] Fix four bugs with imported types in TypeScript.

* When a type had a vector of imported enums:

1) the enum type's file wasn't added to the generated code's list of
imports; and

2) the enum wasn't prefixed with the NS<hash> prefix and wasn't getting
resolved; but

3) non-enum types (ie, "flatbuffers.Offset") were getting the NS<hash>
prefix when they weren't.

* Also, type name prefixes weren't properly attributed with imported
structs in unions because the source definition passed to the typename
prefixing method was for the union, not for the location of the imported
struct.

* clang fmt

* Use of enum_def / struct_def for prefixing types needs to have the files
added to imported files when not generating all types.

* clang fmt
src/idl_gen_js_ts.cpp