Skip to content

Commit

Permalink
Rename the TS options interface an export the unexported types
Browse files Browse the repository at this point in the history
This is a backwards compatible change as the options interface was not previously exported.
  • Loading branch information
sindresorhus committed Sep 12, 2018
1 parent 0c4de4c commit 34e5009
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.d.ts
@@ -1,13 +1,13 @@
/// <reference lib="dom"/>

interface ClearablePromise<T> extends Promise<T> {
export interface ClearablePromise<T> extends Promise<T> {
/**
* Clears the delay and settles the promise.
*/
clear(): void;
}

interface DelayOptions {
export interface Options {
/**
* An optional AbortSignal to abort the delay.
* If aborted, the Promise will be rejected with an AbortError.
Expand All @@ -22,15 +22,15 @@ declare const delay: {
* @param milliseconds - Milliseconds to delay the promise.
* @returns A promise which resolves after the specified `milliseconds`.
*/
(milliseconds: number, options?: DelayOptions): ClearablePromise<void>;
(milliseconds: number, options?: Options): ClearablePromise<void>;

/**
* Create a promise which resolves after the specified `milliseconds`.
*
* @param milliseconds - Milliseconds to delay the promise.
* @returns A promise which resolves after the specified `milliseconds`.
*/
<T>(milliseconds: number, options?: DelayOptions & {
<T>(milliseconds: number, options?: Options & {
/** Value to resolve in the returned promise. */
value: T
}): ClearablePromise<T>;
Expand All @@ -42,7 +42,7 @@ declare const delay: {
* @returns A promise which rejects after the specified `milliseconds`.
*/
// TODO: Allow providing value type after https://github.com/Microsoft/TypeScript/issues/5413 will be resolved.
reject(milliseconds: number, options?: DelayOptions & {
reject(milliseconds: number, options?: Options & {
/** Value to reject in the returned promise. */
value?: any
}): ClearablePromise<never>;
Expand Down

0 comments on commit 34e5009

Please sign in to comment.