microsoft / microsoft/TypeScript

noUnusedParameters incorrectly triggers with @interface JSDoc in JS files

Open
#43,791 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Bug Report

🔎 Search Terms

noUnusedParameters @interface

🕗 Version & Regression Information

Playground link with relevant code

💻 Code
/** @interface */
class FooInterface {
  /** @param {string} id */
  doSomething(id) {}
}
🙁 Actual behavior

Throws the following error

'id' is declared but its value is never read.
🙂 Expected behavior

There should be no error thrown, as this is the correct (and only?) way to declare interfaces with JSDoc in JavaScript files (and also with Closure Compiler)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the diagnostic in the linked TypeScript Playground with noUnusedParameters enabled and JavaScript mode selected. Trace how @interface JSDoc and the doSomething(id) parameter are handled, then confirm that the valid interface pattern no longer reports 'id' as unused and add regression coverage for the case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.