diff --git a/ora/ora-tests.ts b/ora/ora-tests.ts new file mode 100644 index 0000000000..bea4f29b51 --- /dev/null +++ b/ora/ora-tests.ts @@ -0,0 +1,11 @@ +/// + +import ora = require('ora'); +const spinner = ora('Loading unicorns'); + +spinner.start(); + +setTimeout(() => { + spinner.color = 'yellow'; + spinner.text = 'Loading rainbows'; +}, 1000); diff --git a/ora/ora.d.ts b/ora/ora.d.ts new file mode 100644 index 0000000000..f66b65c453 --- /dev/null +++ b/ora/ora.d.ts @@ -0,0 +1,26 @@ +// Type definitions for ora +// Project: https://github.com/sindresorhus/ora +// Definitions by: Basarat Ali Syed +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'ora' { + type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; + type Text = string; + interface Options { + text?: Text; + spinner?: string | { interval?: number; frames: string[]; } + color?: Color; + stream?: any; + } + interface Instance { + start(): void; + stop(): void; + clear(): void; + frame(): void; + render(): void; + text: Text; + color: Color; + } + function ora(options: Options | Text): Instance; + export = ora; +}