Skip to content

Fix duplicate import error when same symbol is imported as both type and value#3291

Merged
mrlubos merged 4 commits into
mainfrom
copilot/fix-duplicate-import-error
Jan 30, 2026
Merged

Fix duplicate import error when same symbol is imported as both type and value#3291
mrlubos merged 4 commits into
mainfrom
copilot/fix-duplicate-import-error

Conversation

Copilot AI commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #3288

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@vercel

vercel Bot commented Jan 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hey-api-docs Ready Ready Preview, Comment Jan 30, 2026 2:09pm

Request Review

@changeset-bot

changeset-bot Bot commented Jan 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3c08e38

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@hey-api/codegen-core Patch
@hey-api/openapi-python Patch
@hey-api/openapi-ts Patch
@hey-api/shared Patch

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

…and value

Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix duplicate import error in sdk.gen.ts Fix duplicate import error when same symbol is imported as both type and value Jan 30, 2026
Copilot AI requested a review from mrlubos January 30, 2026 13:29
@mrlubos

mrlubos commented Jan 30, 2026

Copy link
Copy Markdown
Member

@copilot This looks good. Can you remove the unnecessary comments you added? The code is self documenting.

Can you add unit tests to the planner to verify the imports are correctly deduped and it still works with a single import? Since it's a private function you might need to create some boilerplate to test everything around it. We want to cover 5 scenarios:

  1. There is only 1 imported symbol as value (verify it produces a single value import)
  2. There is only 1 imported symbol as type (verify it produces a single type import)
  3. There are 2 imported symbols as values (verify it produces a single value import)
  4. There are 2 imported symbols as types (verify it produces a single type import)
  5. There are 2 imported symbols, 1 as type, 1 as value (verify it produces a single value import)

…uplication

Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>

Copilot AI commented Jan 30, 2026

Copy link
Copy Markdown
Contributor Author

@copilot This looks good. Can you remove the unnecessary comments you added? The code is self documenting.

Can you add unit tests to the planner to verify the imports are correctly deduped and it sti...

Done in 3f23cef. Removed the comments and added unit tests covering all 5 scenarios:

  1. Single value import
  2. Single type import
  3. Two value imports with same name → single value import
  4. Two type imports with same name → single type import
  5. One type + one value import with same name → single value import

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jan 30, 2026
@mrlubos mrlubos marked this pull request as ready for review January 30, 2026 14:09
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. bug 🔥 Broken or incorrect behavior. labels Jan 30, 2026
@codecov

codecov Bot commented Jan 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 34.91%. Comparing base (124dc28) to head (3c08e38).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3291   +/-   ##
=======================================
  Coverage   34.91%   34.91%           
=======================================
  Files         401      401           
  Lines       22237    22237           
  Branches     1429     1429           
=======================================
  Hits         7763     7763           
  Misses      14470    14470           
  Partials        4        4           
Flag Coverage Δ
unittests 34.91% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pkg-pr-new

pkg-pr-new Bot commented Jan 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

@hey-api/codegen-core

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/codegen-core@3291

@hey-api/nuxt

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/nuxt@3291

@hey-api/openapi-ts

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/openapi-ts@3291

@hey-api/shared

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/shared@3291

@hey-api/types

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/types@3291

@hey-api/vite-plugin

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/vite-plugin@3291

commit: 3c08e38

@mrlubos mrlubos merged commit caabc9f into main Jan 30, 2026
11 checks passed
@mrlubos mrlubos deleted the copilot/fix-duplicate-import-error branch January 30, 2026 14:23
@hey-api hey-api Bot mentioned this pull request Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🔥 Broken or incorrect behavior. lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merged Zod type & schema name causes duplicate import error in sdk.gen.ts

2 participants