Skip to content

Commit

Permalink
Fix generated typescript importing parent directory
Browse files Browse the repository at this point in the history
  • Loading branch information
hhvrc committed Jun 24, 2024
1 parent fb9afba commit 053feb0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/idl_gen_ts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ class TsGenerator : public BaseGenerator {
std::copy(it.second.ns->components.begin(),
it.second.ns->components.end(),
std::back_inserter(rel_components));

// Remove leading relative components from the path until the first matching directory is found.
while (!rel_components.empty() && it.second.symbolic_name != rel_components.front()) {
rel_components.erase(rel_components.begin());
}

auto base_file_name =
namer_.File(*(def.second), SkipFile::SuffixAndExtension);
auto base_name =
Expand Down

0 comments on commit 053feb0

Please sign in to comment.