-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Using arguments should be an error with noImplicitAny #25285
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
Comments
None of these expressions meet the criteria of |
@RyanCavanaugh I see, because they’re not declarations? What would it take for TSC to catch these? The issue here is that arguments is unsafe, and a user wouldn’t know about it. |
@bcherny basically there's a difference between an
You'd really need a new type like |
Even if What would be an error under this schema that isn't an error under a lint rule banning referencing |
Got it. For anyone that finds this thread in the future, the issue is that I'll use a lint rule for now (doesn't look like TSLint has one already, so will add one). I wonder if TSC should have a mode where it's more aggressive about banning
|
@RyanCavanaugh Thanks for linking that thread, and thanks to the TS team for documenting the discussion. Do you guys plan to replace |
No, But really this is the sort of perfect situation where you want to defer to a library consumer's strictness settings as to how a type can be used. |
You can try TSLint no-unsafe-any rule |
TypeScript Version: 3.0.0-dev.20180628
Search Terms: argument, parameter, arguments, list, any, untyped
Code
Expected behavior: TSC should complain that
total
,n
, andsumVariadic
's return type are implicitlyany
whennoImplicitAny=true
.Actual behavior:
total
,n
, andsumVariadic
's return type areany
. No errors are thrown.Playground Link: https://www.typescriptlang.org/play/index.html#src=function%20sumVariadic()%20%7B%0A%20%20return%20Array%0A%20%20%20%20.from(arguments)%0A%20%20%20%20.reduce((total%2C%20n)%20%3D%3E%20total%20%2B%20n%2C%200)%0A%7D%0A
Related Issues:
The text was updated successfully, but these errors were encountered: