diff --git a/ora/index.d.ts b/ora/index.d.ts index a31d2bd5c1..e45a585442 100644 --- a/ora/index.d.ts +++ b/ora/index.d.ts @@ -1,36 +1,34 @@ // Type definitions for ora v0.3.0 // Project: https://github.com/sindresorhus/ora -// Definitions by: Basarat Ali Syed +// Definitions by: Basarat Ali Syed , Christian Rackerseder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// - type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; -type Text = string; interface Options { - text?: Text; - spinner?: string | Spinner; + text?: string; + spinner?: string | Spinner; color?: Color; - interval?: number; - stream?: NodeJS.WritableStream; - enabled?: boolean; - } - interface Spinner { - interval?: number; - frames: string[]; + interval?: number; + stream?: NodeJS.WritableStream; + enabled?: boolean; +} +interface Spinner { + interval?: number; + frames: string[]; } interface Instance { - start(): Instance; - stop(): Instance; - succeed(): Instance; - fail(): Instance; - stopAndPersist(symbol?: string): Instance; - clear(): Instance; - render(): Instance; - frame(): Instance; - text: string; + start(): Instance; + stop(): Instance; + succeed(): Instance; + fail(): Instance; + stopAndPersist(symbol?: string): Instance; + clear(): Instance; + render(): Instance; + frame(): Instance; + text: string; color: Color; } -declare function ora(options: Options | Text): Instance; +declare function ora(options: Options | string): Instance; export = ora; diff --git a/ora/ora-tests.ts b/ora/ora-tests.ts index 067edd8678..b6e2a671dc 100644 --- a/ora/ora-tests.ts +++ b/ora/ora-tests.ts @@ -1,7 +1,6 @@ import ora = require('ora'); -const spinner = ora('Loading unicorns'); -spinner.start(); +const spinner = ora('Loading unicorns').start(); setTimeout(() => { spinner.color = 'yellow';