Skip to content
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

Closed
pqnet opened this issue Aug 21, 2019 · 1 comment
Closed

Allow Promise<void> with no-invalid-void #4832

pqnet opened this issue Aug 21, 2019 · 1 comment

Comments

@pqnet
Copy link

pqnet commented Aug 21, 2019

The no-invalid-void doesn't allow usage of void anywhere beside on return types. This excludes the ability to create a Promise<void> type, used for functions such as async() { return; } and in expressions such as async(x: Promise<void>) { await x; }

As a Promise represents a delayed result of a function, void should be allowed in the Promise<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.

@JoshuaKGoldberg
Copy link
Contributor

Agreed! Duplicate of #4828.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants