google / google/flatbuffers

Extension `.js` apears in TS files when importing a schima [TypeScript, OS X, FlatBuffers 23.5.26]

Open
#8,105 12 comments 4 reactions 0 assignees View on GitHub
pr-requested typescript
Dominant language
C++
Stars
26.5k
Forks
3.7k
PR merge metrics
No merged PRs in 30d

Description

Hello!

Even though I generate the TS files using the `--ts-no-import-ext`, when you have an import in one of your schemas, the TS file will still contain an export with a `.js` extension:

If I have the following schemas:

```fbs
// color.fbs

enum Color:byte { Red = 0, Green, Blue = 2 }
```

```fbs
// monster.fbs

include "color.fbs";

namespace Sample;

table Monster {
color:Color = Blue; // Enum.
}

root_type Monster;
```

After running `flatc --ts --ts-no-import-ext -o monsters_generated monster.fbs` we get a file monster.ts with the following content:

```ts
// automatically generated by the FlatBuffers compiler, do not modify

export { Color } from './color';
export * as Sample from './sample.js';
```

Thank you!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.