We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
TS2534 await
Versions tried on:
https://www.typescriptlang.org/play?ts=4.8.0-dev.20220714#code/GYVwdgxgLglg9mABAWwIYGsCmARTUGr4BOAFAJQBciACkXMjAM6YA8YmAbpkQHyIDeAKEQjERPCCJJa9JpgB04gFaZoJdgHdEAUSJ1SAIgBCcegEIDZMgG5BAX0GDQkWAkQATPASiYAjOSoZBmY2Tm4+IREIBEYoDy8wQjgiILlEAF4UDBwEpNIbYTEJKXj8ROJU5lsHQVRGAE9IRGdoeCRPMsJMACYAmjpg1nYuXgFC6LBY0u9kyswMrKxcTuJyWxFUDVQYOI6ZlIG5aqA
function makeDetonator(): Promise<never> { return Promise.reject(new Error("Boom!")); } function detonate1(): Promise<never> { const detonatorPromise = makeDetonator(); return detonatorPromise; } async function detonate2(): Promise<never> { const detonatorPromise = makeDetonator(); await detonatorPromise; }
detonate1 has no issues, but get the following error for detonate2:
A function returning 'never' cannot have a reachable end point.
detonate2 is semantically equivalent to detonate1, and there should be no such error.
It looks like the general rule that's missing is: awaiting on a Promise would make the rest of the block unreachable.
The text was updated successfully, but these errors were encountered:
Duplicate of #34955. Used search terms: promise never in:title
promise never in:title
Sorry, something went wrong.
No branches or pull requests
Bug Report
🔎 Search Terms
TS2534 await
🕗 Version & Regression Information
Versions tried on:
⏯ Playground Link
https://www.typescriptlang.org/play?ts=4.8.0-dev.20220714#code/GYVwdgxgLglg9mABAWwIYGsCmARTUGr4BOAFAJQBciACkXMjAM6YA8YmAbpkQHyIDeAKEQjERPCCJJa9JpgB04gFaZoJdgHdEAUSJ1SAIgBCcegEIDZMgG5BAX0GDQkWAkQATPASiYAjOSoZBmY2Tm4+IREIBEYoDy8wQjgiILlEAF4UDBwEpNIbYTEJKXj8ROJU5lsHQVRGAE9IRGdoeCRPMsJMACYAmjpg1nYuXgFC6LBY0u9kyswMrKxcTuJyWxFUDVQYOI6ZlIG5aqA
💻 Code
🙁 Actual behavior
detonate1 has no issues, but get the following error for detonate2:
🙂 Expected behavior
detonate2 is semantically equivalent to detonate1, and there should be no such error.
It looks like the general rule that's missing is: awaiting on a Promise would make the rest of the block unreachable.
The text was updated successfully, but these errors were encountered: