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

@imports marked as unused #58969

Closed
lishaduck opened this issue Jun 22, 2024 · 2 comments
Closed

@imports marked as unused #58969

lishaduck opened this issue Jun 22, 2024 · 2 comments
Assignees
Labels
Needs Investigation This issue needs a team member to investigate its status.

Comments

@lishaduck
Copy link

πŸ”Ž Search Terms

@import noUnused

πŸ•— Version & Regression Information

  • I was unable to test this on prior versions because it uses @import

⏯ Playground Link

No response

πŸ’» Code

This requires multiple files, so the TS playground won't work. Sorry.

// bar.js
/** @import {foo} from "foo"; */

/**
 * @param baz {foo}
 */
function bar(baz) {}

With this in the TSConfig

"noUnusedLocals": true,
"noUnusedParameters": true,

πŸ™ Actual behavior

Foo is marked as unused.
It's being used in a JSDoc

πŸ™‚ Expected behavior

It shouldn't be marked as unused.

Additional information about the issue

This doesn't appear all the time, usually when there's multiple imports.
The example doesn't actually error, the code erroring got force-pushed away. However, it's the general issue.

I thought it might need a type qualifier, but that doesn't seem to be valid.

@lishaduck lishaduck changed the title @import @imports marked as unused Jun 22, 2024
@lishaduck
Copy link
Author

Oh, I didn't look at PR comments. I think this still needs an issue though: #57207 (comment)

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Jun 24, 2024
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 5.6.0 milestone Jun 24, 2024
jaydenseric added a commit to jaydenseric/graphql-react that referenced this issue Jul 12, 2024
See:

https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#the-jsdoc-import-tag

Note that the JSDoc type imports have to be before the real module imports to workaround this TypeScript bug where sometimes the type imports are falsely considered unused:

microsoft/TypeScript#58368 (comment)
microsoft/TypeScript#58969
@lishaduck
Copy link
Author

lishaduck commented Aug 14, 2024

Duplicate of #58368. (though there are more thumbs-ups here, and the issue title is less broad)

@lishaduck lishaduck closed this as not planned Won't fix, can't repro, duplicate, stale Aug 14, 2024
jaydenseric added a commit to jaydenseric/graphql-upload that referenced this issue Oct 4, 2024
See:

https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#the-jsdoc-import-tag

Note that the JSDoc type imports have to be before the real module imports to workaround this TypeScript bug where sometimes the type imports are falsely considered unused:

microsoft/TypeScript#58368 (comment)
microsoft/TypeScript#58969
jaydenseric added a commit to jaydenseric/find-unused-exports that referenced this issue Oct 10, 2024
While issues have not yet been discovered in this project, JSDoc type imports have to be before the real module imports to workaround this TypeScript bug where sometimes the type imports are falsely considered unused:

microsoft/TypeScript#58368 (comment)
microsoft/TypeScript#58969
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

No branches or pull requests

3 participants