google / flatbuffers

FlatBuffers: Memory Efficient Serialization Library

Home Page:https://flatbuffers.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[TS] Top-level exports file only contains types referenced from other types

Macil opened this issue · comments

// foo.fbs
namespace com.example.foo;

struct OptionalLong {
  value: long;
}

struct OptionalDouble {
  value: double;
}

table Person {
  display_name: string;
  last_calculated_timestamp: OptionalLong;
}

table Box {
  box_id: int;
}

root_type Box;
$ flatc --version
flatc version 2.0.6
$ flatc --ts *.fbs
$ ls
com     foo.fbs foo.ts
$ cat foo.ts
export { OptionalLong } from './com/example/foo/optional-long';
$ ls com/example/foo
box.ts             optional-double.ts optional-long.ts   person.ts

The files inside com/example/foo all have the expected contents. However, foo.ts only re-exports some of the types. It's possible for the top-level exports file to be empty (which also happens to be invalid if you have Typescript set with the isolatedModules:true option, which is recommended when using Babel to compile the Typescript).

This is possibly the same as #7083