You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A function with the async keyword will never be able to have throws, but I think it is meaningful to have a means of documenting the types that are rejected.
FWIW, TypeScript assumes "any"type for the rejected value, even while allowing the resolved value to be specified. Barring such a convention for specifying the rejected value, I think we need to allow for a means of requiring that the rejected value be documented.
There could admittedly be ambiguity in functions which are only async in having an @async tag, but which are regular functions which may throw synchronously as well as perform some async behavior (which may reject), but without a convention, I think it is better for this function to require the error types be documented, and consumers will just have to know that "throws" here refers to the rejection type given that the function is async.
We could potentially add config to prevent this, however.
Expected behavior
Do not report
require-throws
when athrow
is added in anasync
function (because the function returns a rejected promise).Actual behavior
If an
async
function contains athrow
, ESLint reportrequire-throws
rule:ESLint Config
ESLint sample
Environment
eslint-plugin-jsdoc
version: 33.0.0The text was updated successfully, but these errors were encountered: