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

Awaiting a function that returns never or Promise<never> does not mark the code below as unreachable #44911

Closed
AlCalzone opened this issue Jul 6, 2021 · 2 comments

Comments

@AlCalzone
Copy link
Contributor

Bug Report

πŸ”Ž Search Terms

await, never, promise

πŸ•— Version & Regression Information

The last line starts being marked as unreachable in 3.7.x, but the others aren't in any version

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

declare function syncNever(): never;
declare function asyncNever(): Promise<never>;

async function run(): Promise<void> {
  if (true) {
    await asyncNever();
    await syncNever(); // not marked as unreachable
    syncNever(); // not marked as unreachable
  }
  console.log("foo"); // correctly marked as unreachable
}

πŸ™ Actual behavior

Only the last line is marked as unreachable.

πŸ™‚ Expected behavior

Expected everything after await asyncNever(); to be marked as unreachable.

@MartinJohns
Copy link
Contributor

Duplicate of #34955. Used search terms: await never in:title

@AlCalzone
Copy link
Contributor Author

I swear that didn't show up πŸ™ˆ

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

No branches or pull requests

2 participants