This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
Allow Promise<void>
with no-invalid-void
#4832
Labels
Promise<void>
with no-invalid-void
#4832
The
no-invalid-void
doesn't allow usage ofvoid
anywhere beside on return types. This excludes the ability to create aPromise<void>
type, used for functions such asasync() { return; }
and in expressions such asasync(x: Promise<void>) { await x; }
As a
Promise
represents a delayed result of a function,void
should be allowed in thePromise<void>
type expression in the same way it is allowed in() => void
type expression.It would be better to have the ability to add an exception to the rule to specify a list of generic types where
void
is allowed because it is semantically referring to a return type of a function.The text was updated successfully, but these errors were encountered: