return clearable promise type

This commit is contained in:
İlker Yıldırım 2020-08-06 01:20:42 +03:00
parent 1dae5b6c2c
commit f6c2339acb
1 changed files with 7 additions and 3 deletions

10
index.d.ts vendored
View File

@ -40,6 +40,10 @@ declare namespace pTimeout {
};
}
interface ClearablePromise<T> extends Promise<T>{
clear: Function
}
declare const pTimeout: {
TimeoutError: typeof TimeoutErrorClass;
@ -71,7 +75,7 @@ declare const pTimeout: {
milliseconds: number,
message?: string | Error,
options?: pTimeout.Options
): Promise<ValueType>;
): ClearablePromise<ValueType>;
/**
Timeout a promise after a specified amount of time.
@ -100,7 +104,7 @@ declare const pTimeout: {
milliseconds: number,
fallback: () => ReturnType | Promise<ReturnType>,
options?: pTimeout.Options
): Promise<ValueType | ReturnType>;
};
): ClearablePromise<ValueType | ReturnType>;
};
export = pTimeout;