Skip to content
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

🔄 Unused exported types not being reported when consumed in the same file #830

Closed
4 tasks done
adamrutherfordshaw opened this issue Nov 11, 2024 · 4 comments
Closed
4 tasks done
Labels
regression Something is no longer working

Comments

@adamrutherfordshaw
Copy link

adamrutherfordshaw commented Nov 11, 2024

Prerequisites

Reproduction url

https://stackblitz.com/edit/github-ckjg6m?file=README.md

Reproduction access

  • I've made sure the reproduction is publicly accessible

Good version

5.31.0

Bad version

5.32.0 onwards

Description of the regression

Unused exports of types that are used in the same file are no longer reported. However, other unused exports not used in the same file continue to be reported as expected.

The behaviour cannot be fixed by explicitly setting ignoreExportsUsedInFile: false in the config.

In the attached repro, I have created two exported functions, and three exported types. The unused internalFunction is correctly reported, however only the ThisInterfaceDoesFail interface is reported, and not the ThisInterfaceDoesNotFail interface, despite it being an unused export.

I've identified this as the first bad commit: 14d2cfc2773e1615373dd0e69c152c3edb7d1255, released in 5.32.0.

@adamrutherfordshaw adamrutherfordshaw added the regression Something is no longer working label Nov 11, 2024
@adamrutherfordshaw adamrutherfordshaw changed the title 🔄 Unused export 🔄 Unused exported types not being reported when consumed in the same file Nov 11, 2024
@webpro webpro closed this as completed in 80537c5 Nov 11, 2024
@webpro
Copy link
Collaborator

webpro commented Nov 11, 2024

Thanks @adamrutherfordshaw! Unfortunately it's a tad less straightforward so we've needed a few more iterations to get it right. Any chance you could give this version a shot in your project(s) before we release?

npm i -D https://pkg.pr.new/knip@80537c5

@adamrutherfordshaw
Copy link
Author

Just pulled down and tested in two projects and the repro I linked, works great 👌 Thanks! 🙂

@webpro
Copy link
Collaborator

webpro commented Nov 11, 2024

🚀 This issue has been resolved in v5.36.7. See Release 5.36.7 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.

@webpro
Copy link
Collaborator

webpro commented Nov 11, 2024

Thanks for confirming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Something is no longer working
Projects
None yet
Development

No branches or pull requests

2 participants