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

No error on awaiting non-awaitable function #18542

Closed
ZoolWay opened this issue Sep 18, 2017 · 2 comments
Closed

No error on awaiting non-awaitable function #18542

ZoolWay opened this issue Sep 18, 2017 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@ZoolWay
Copy link

ZoolWay commented Sep 18, 2017

TypeScript Version: 2.5.2

Code

class Test {
  public async test(): Promise<void> {
    await test2();
  }
  public test2(): boolean {
    console.info('test2');
    return true;
  }
}

Expected behavior:
Compiler warning or error that test2() is not awaitable because it does not return a Promise.

Actual behavior:
No warning or error, compiles unnecessarily into an awaiter wrapped function.

@kitsonk
Copy link
Contributor

kitsonk commented Sep 18, 2017

Did you mean await this.test2();?

Even still, duplicate of #8310.

Search is your friend.

@ZoolWay
Copy link
Author

ZoolWay commented Sep 18, 2017

Did a search but guess I just included open issues.

Nevertheless, thanks! As this is intended for the reasons meantioned in #8310 I look into linting to avoid this error.

@ZoolWay ZoolWay closed this as completed Sep 18, 2017
@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Sep 18, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants