-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[no-object-literal-type-assertion] make allowAsParameter work with "throw" keyword? #668
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
I don't understand - what does casting a Why not create a class, or a utility function? |
In my case, which is front-end, I want to adhere to a certain structure for the thrown objects, because all these objects with different error code will propagate to a central Yes there're many ways to do it. I could also just create a typed variable and throw that variable. Maybe I fell into that mentality of "I got a cool idea so let's file an issue because why not"... Feel free to close it. :) |
It wouldn't fall under the We could always add a new option for operators. |
One thing I've always been confused about is that |
Sorry, I wasn't intending to use the strict definition of the word It's a statement. Same as things like Similar to those, they don't have "parameters" and are not covered by the ruke |
My code:
Expected Result
I hope eslint would allow it, since I've set
"allowAsParameter": true
Actual Result
It's not allowed, because
throw
is not a function, it's a function-like keyword, just liketypeof
ordelete
.Could we make it treat
throw
as a function in regards to"allowAsParameter": true
?Versions
@typescript-eslint/eslint-plugin
1.9.0
@typescript-eslint/parser
1.9.0
TypeScript
3.4.5
ESLint
5.16.0
node
10.15.3
npm
6.9.0
The text was updated successfully, but these errors were encountered: