-
Notifications
You must be signed in to change notification settings - Fork 1.5k
noUnusedParameters: add note about underscore prefix exception #3178
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
| Parameters declaration with names starting with an underscore _ are exempt from the unused parameter checking. e.g.: | ||
|
|
||
| ```ts twoslash | ||
| function returnNull(_a) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a type annotation to prevent the error: https://victorious-plant-05c166c10-3178.centralus.5.azurestaticapps.net/tsconfig/#noUnusedParameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, set // @noUnusedParameters here. Best to copy the above example and just rename the parameter, actually (but without the @errors)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do!
Copy first example, modify for the example
|
Finally got back to this. @jakebailey thanks for the feedback, should be ready to go...hopefully! |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://victorious-plant-05c166c10-3178.centralus.5.azurestaticapps.net |
jakebailey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit, given _ is special in markdown.
packages/tsconfig-reference/copy/en/options/noUnusedParameters.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
|
Just remembered this issue and committed that change, @jakebailey. Anything else? |
|
Thank you!! |
In the release notes for noUnusedParameters, there's a note about prefixing the parameter name with an underscore to bypass this error.
This PR adds that same note and example to the noUnusedParameters documentation.
(thanks to @lindboe for noticing this and pointing me to the release docs!)