Skip to content

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

@dirkluijk

Description

@dirkluijk

⚙ 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

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptFix AvailableA PR has been opened for this issueGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions