Skip to content

Instantly share code, notes, and snippets.

@hagevvashi
Last active April 4, 2020 17:15
Show Gist options
  • Save hagevvashi/e8d3c76b891ec5e16cd9e29f002d04e3 to your computer and use it in GitHub Desktop.
Save hagevvashi/e8d3c76b891ec5e16cd9e29f002d04e3 to your computer and use it in GitHub Desktop.
Promise.rejectionを発生させる例
const causeUnhandledRejectionAfter =
  (timeout: number): Promise<void> =>
    new Promise((resolve, reject): number =>
      setTimeout(reject, timeout));

causeUnhandledRejectionAfter(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment