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

Idea: type that can't be ignored #2281

Closed
vkurchatkin opened this issue Aug 18, 2016 · 3 comments
Closed

Idea: type that can't be ignored #2281

vkurchatkin opened this issue Aug 18, 2016 · 3 comments

Comments

@vkurchatkin
Copy link
Contributor

One common source of error is forgetting to use promise:

async function main() {
  foo(); // should be await foo();
}

This can be solved with generic $MustUse type:

async function foo(): $MustUse<Promise<void>> {
// ...
}
@AriaFallah
Copy link

AriaFallah commented Dec 22, 2016

@vkurchatkin

Is there anything like this currently? I'm looking to solve the exact problem in your example.

@vkurchatkin
Copy link
Contributor Author

Not to my knowledge

@SamChou19815
Copy link
Contributor

This is now implemented with unused promise lint.

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

No branches or pull requests

4 participants