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

[Feature Request] skip --noImplicitAny checks when using _ #14154

Closed
masters3d opened this issue Feb 17, 2017 · 6 comments
Closed

[Feature Request] skip --noImplicitAny checks when using _ #14154

masters3d opened this issue Feb 17, 2017 · 6 comments

Comments

@masters3d
Copy link

masters3d commented Feb 17, 2017

TypeScript Version: Version 2.3.0-dev.20170217

Code

// A *self-contained* demonstration of the problem follows...
// "noImplicitAny": true,
const myFunc = ( _   , index: number) => { //[ts] Parameter '_' implicitly has an 'any' type.
    return `${index}`;
 }

Expected behavior:

skip errors "noImplicitAny": when using _

Actual behavior:

[ts] Parameter '_' implicitly has an 'any' type.

@Strate
Copy link

Strate commented Feb 17, 2017

I don't think that it should be ignored. You can use {} to ignore argument

@masters3d masters3d changed the title [bug] _ doesn't get ignored with --noImplicitAny [bug] _ doesn't skip check with --noImplicitAny Feb 17, 2017
@masters3d
Copy link
Author

@Strate I meant to say to not give errors. Same behavior as
#9458

@masters3d masters3d changed the title [bug] _ doesn't skip check with --noImplicitAny _ doesn't skip check with --noImplicitAny Feb 17, 2017
@blakeembrey
Copy link
Contributor

I don't think I'd want to skip implicit any checks using the underscore. It's currently used for ignoring the unused parameter. Is this a bug report, regression or feature request?

@masters3d masters3d changed the title _ doesn't skip check with --noImplicitAny [Feature Request]_ doesn't skip check with --noImplicitAny Feb 17, 2017
@masters3d masters3d changed the title [Feature Request]_ doesn't skip check with --noImplicitAny [Feature Request] skip --noImplicitAny checks when using _ Feb 17, 2017
@masters3d
Copy link
Author

@blakeembrey Feature Request since I don't think this was working before.

I need the parameter there so I can pass it to .map() or similar.
It is weird that I need to specify _: any for something I already tagged to skip errors.

@Strate
Copy link

Strate commented Feb 18, 2017

Underscore has no special meaning in pure javascript. It is valid identifier for variable. To skip unused argument you can write like this:

function myMap({}, index: number) {
  return `${index}`
}

@masters3d
Copy link
Author

Thanks @Strate ! This was your first suggestion too :)

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants