Skip to content

Update ESNext with Promise.try (stage 4) #60223

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

Closed
dirkluijk opened this issue Oct 14, 2024 · 0 comments · Fixed by #60232
Closed

Update ESNext with Promise.try (stage 4) #60223

dirkluijk opened this issue Oct 14, 2024 · 0 comments · Fixed by #60232
Assignees
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fix Available A PR has been opened for this issue Good First Issue Well scoped, documented and has the green light Help Wanted You can do this

Comments

@dirkluijk
Copy link
Contributor

dirkluijk commented Oct 14, 2024

⚙ Compilation target

ESNext / ES2025

⚙ Library

ESNext / ES2025

Missing / Incorrect Definition

Last week, Promise.try got into stage 4. Not sure if this is already in scope for the upcoming TS release, just adding this ticket to track this.

Sample Code

function doSomething(action) {
  return Promise.try(action)
    .then((result) => console.log(result))
    .catch((error) => console.error(error))
    .finally(() => console.log("Done"));
}

doSomething(() => "Sync result");

doSomething(() => {
  throw new Error("Sync error");
});

doSomething(async () => "Async result");

doSomething(async () => {
  throw new Error("Async error");
});

Documentation Link

@dirkluijk dirkluijk changed the title Update ESNext/ES2023 with Promise.try (stage 4) Update ESNext/ES2024 with Promise.try (stage 4) Oct 14, 2024
@DanielRosenwasser DanielRosenwasser added the Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript label Oct 14, 2024
@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Help Wanted You can do this labels Oct 14, 2024
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 5.8.0 milestone Oct 14, 2024
@DanielRosenwasser DanielRosenwasser added the Good First Issue Well scoped, documented and has the green light label Oct 14, 2024
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Oct 15, 2024
@dirkluijk dirkluijk changed the title Update ESNext/ES2024 with Promise.try (stage 4) Update ESNext with Promise.try (stage 4) Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fix Available A PR has been opened for this issue Good First Issue Well scoped, documented and has the green light Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants