-
-
Notifications
You must be signed in to change notification settings - Fork 241
Fix default import placeholder replacement in TypeScript renderer #2674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🦋 Changeset detectedLatest commit: 762b20e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@copilot I think the problem is that the renderer doesn't handle replacing symbols for default imports yet |
Co-authored-by: mrlubos <[email protected]>
Exactly right! I've fixed this by adding |
commit: |
The TypeScript renderer was not properly replacing symbol placeholders in default imports, causing generated code to contain internal placeholder names instead of the resolved symbol names.
Problem:
When generating default imports, the renderer used
value.defaultBinding
directly without processing it throughrenderIds
to replace symbol placeholders. This resulted in imports like:Instead of the expected:
Solution:
Applied the same
renderIds
processing to default bindings that was already being used for namespace bindings. This ensures that symbol placeholders are properly resolved to their final names during import generation.Changes:
getImportLines
method inpackages/openapi-ts/src/generate/renderer.ts
to process default binding placeholdersTesting:
The fix is verified by a new test that creates a symbol with a placeholder and confirms it gets replaced with the resolved name in the generated import statement.
Fixes #2673.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.