Skip to content

Instantly share code, notes, and snippets.

@zheeeng
Created July 6, 2018 10:26
Show Gist options
  • Save zheeeng/770561662b067f27f658f57686f62def to your computer and use it in GitHub Desktop.
Save zheeeng/770561662b067f27f658f57686f62def to your computer and use it in GitHub Desktop.
Promise interface with Reject ReturnType
interface IPromise<T, U> {
then<TResult1 = T, TResult2 = never>(
onfulfilled?:
| ((value: T) => TResult1 | PromiseLike<TResult1>)
| undefined
| null,
onrejected?:
| ((reason: U) => TResult2 | PromiseLike<TResult2>)
| undefined
| null
): IPromise<TResult1 , TResult2>;
catch<TResult = never>(
onrejected?:
| ((reason: U) => TResult | PromiseLike<TResult>)
| undefined
| null): Promise<TResult>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment