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

--noUnusedParameters does not work good enough #9860

Closed
KnisterPeter opened this issue Jul 21, 2016 · 4 comments
Closed

--noUnusedParameters does not work good enough #9860

KnisterPeter opened this issue Jul 21, 2016 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@KnisterPeter
Copy link
Contributor

KnisterPeter commented Jul 21, 2016

TypeScript Version: 2.0.0

Code

function fn(p1: any, p2: any): void {
  return p2;
}

Expected behavior:
This should compile even with --noUnusedParameters

Actual behavior:
Fails when p1 is unused.

Since this is method signature and callside may not be possible to fix this, the compiler should only flag unused from the end.

@mhegazy
Copy link
Contributor

mhegazy commented Jul 21, 2016

Change the name of p1 to start with _. Parameters with underscores are exempt from error reporting.

@mhegazy mhegazy added the Working as Intended The behavior described is the intended behavior; this is not a bug label Jul 21, 2016
@KnisterPeter
Copy link
Contributor Author

Interesting hidden feature. 😆
Did you mean with 'working as intended' that this is not subject to change and this is not a bug?
Then I would say 'noUnusedParameters' is unusable, because developers need to know the hidden '_' prefix feature. This does not lead to clean and readable code (IMHO).

@yortus
Copy link
Contributor

yortus commented Jul 21, 2016

This is a duplicate of #9458

@RyanCavanaugh RyanCavanaugh added Duplicate An existing issue was already created and removed Working as Intended The behavior described is the intended behavior; this is not a bug labels Jul 21, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Jul 21, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants