Skip to content

Conversation

@hristozov
Copy link
Contributor

@hristozov hristozov commented Oct 29, 2025

Problem

See #383.

Long story short, exports that use reserved keywords (e.g. import) in index.ts files (when "indexFile": true) do not have the $ prefix used everywhere else in the emitted code. As a result, the index.ts would reference import which is import$ everywhere else. This leads to TS code that does not compile.

Solution

The ensureNotReserved helper applies the $ suffix. It's already applieds on the methodName to produce importName. However, the index.ts template references methodName and not the importName.

This change switches the template to importName.

Also wrote a test for the problematic case, that fails without the current fix. To use the generated functions in the test, I had to expose them from ng-openapi-gen.ts.

@luisfpg
Copy link
Contributor

luisfpg commented Nov 24, 2025

I'm sorry, but I went through the open issues first, and ended up fixing #383 without noticing this PR...
Anyway, another issue (#389) changed again this fix, because it needed additional work.
Thanks for the PR, anyway.

@luisfpg luisfpg closed this Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants