-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from tommy351/fix-types
Update type definitions
- Loading branch information
Showing
3 changed files
with
70 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,47 @@ | ||
import { Chalk } from 'chalk'; | ||
|
||
export interface Spinner { | ||
interval: number; | ||
frames: string[]; | ||
} | ||
declare namespace progressEstimator { | ||
interface Spinner { | ||
interval: number; | ||
frames: string[]; | ||
} | ||
|
||
export interface ChalkTheme extends Chalk { | ||
asciiCompleted: Chalk; | ||
asciiInProgress: Chalk; | ||
estimate: Chalk; | ||
estimateExceeded: Chalk; | ||
label: Chalk; | ||
percentage: Chalk; | ||
progressBackground: Chalk; | ||
progressForeground: Chalk; | ||
} | ||
interface ChalkTheme extends Chalk { | ||
asciiCompleted: Chalk; | ||
asciiInProgress: Chalk; | ||
estimate: Chalk; | ||
estimateExceeded: Chalk; | ||
label: Chalk; | ||
percentage: Chalk; | ||
progressBackground: Chalk; | ||
progressForeground: Chalk; | ||
} | ||
|
||
export interface Configuration { | ||
spinner?: Spinner; | ||
storagePath?: string; | ||
theme?: ChalkTheme; | ||
} | ||
interface LogFunction { | ||
(...text: string[]): void; | ||
clear(): void; | ||
done(): void; | ||
} | ||
|
||
interface Configuration { | ||
logFunction?: LogFunction; | ||
spinner?: Spinner; | ||
storagePath?: string; | ||
theme?: ChalkTheme; | ||
} | ||
|
||
interface LogOption { | ||
estimate?: number; | ||
id?: string; | ||
} | ||
|
||
export interface ProgressEstimator { | ||
<T>(promise: Promise<T>, label: string, estimatedDuration?: number): Promise< | ||
T | ||
>; | ||
configure(options: Configuration): void; | ||
logProgress: ProgressEstimator; | ||
interface ProgressEstimator { | ||
<T>(promise: Promise<T>, label: string, options?: LogOption): Promise<T>; | ||
} | ||
} | ||
|
||
export declare const configure: (options: Configuration) => void; | ||
export declare const logProgress: ProgressEstimator; | ||
declare function progressEstimator( | ||
config?: progressEstimator.Configuration | ||
): progressEstimator.ProgressEstimator; | ||
|
||
declare const progressEstimator: ProgressEstimator; | ||
export default progressEstimator; | ||
export = progressEstimator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters