Closed
Description
{
"rules": {
"@typescript-eslint/no-object-literal-type-assertion": ["error", {
"allowAsParameter": true
}]
}
}
My code:
else throw { code: 'E42', message: 'foo failed' } as CustomError;
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 like typeof
or delete
.
Could we make it treat throw
as a function in regards to "allowAsParameter": true
?
Versions
package | version |
---|---|
@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 |