flatbuffers icon indicating copy to clipboard operation
flatbuffers copied to clipboard

[TS] flatc flags `--ts-flat-files` and `--ts-entry-points` have no effect

Open yblein opened this issue 5 months ago • 0 comments

Using --ts-flat-files makes flatc output those 3 lines:

> ./flatc -o /tmp/fb --ts samples/monster.fbs --ts-flat-files
Entry point /tmp/fb/monster.ts generated.
A single file bundle can be created using fx. esbuild with:
> esbuild /tmp/fb/monster.ts --format=cjs --bundle --outfile=/tmp/fb/monster_generated.js --external:flatbuffers

However, despite it claiming to have generated /tmp/fb/monster.ts, no such file exists. Additionally, it still generated the exact same files as without any flags:

> tree /tmp/fb/my-game
/tmp/fb/my-game
├── sample
│   ├── color.ts
│   ├── equipment.ts
│   ├── monster.ts
│   ├── vec3.ts
│   └── weapon.ts
└── sample.ts

A quick look into src/idl_gen_ts.cpp shows that the field IDLOptions::ts_flat_files is indeed only used to decide whether to print the above message or not, and has not effect whatsoever on code generation.

Additionally, I was also surprised to see that IDLOptions::ts_entry_points is never read, and has no effect on code generation either. I looked into it since it is implied by --ts-flat-files (per flatc --help).

This was run from a fresh build on linux:

> git describe --always --dirty
v25.2.10-52-g48eccb83
> g++ -dumpmachine
x86_64-pc-linux-gnu

yblein avatar Sep 12 '25 13:09 yblein