From 959aa65ef4e74a34c5909fe7f7789b682f8d07df Mon Sep 17 00:00:00 2001 From: Cedric Hurst Date: Sat, 30 Oct 2021 16:03:02 -0500 Subject: [PATCH 1/2] Provide proper typings for cli.progress() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi! 👋 Firstly, thanks for your work on this project! 🙂 At the moment, `cli.progress()` takes an option argument of `any` and returns `any`. This makes it difficult to validate which options are valid and which operations are available on the result of the function. There may be a reason that `any` is specified here. But if it was an oversight, this PR should resolve the issue. --- src/styled/progress.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/styled/progress.ts b/src/styled/progress.ts index bcd78dd6..868c936a 100644 --- a/src/styled/progress.ts +++ b/src/styled/progress.ts @@ -1,13 +1,9 @@ // 3pp const cliProgress = require('cli-progress') -export default function progress(options?: any): any { - // if no options passed, create empty options - if (!options) { - options = {} - } +export default function progress(options: cliProgress.Options = {}): cliProgress.SingleBar { // set noTTYOutput for options - options.noTTYOutput = Boolean(process.env.TERM === 'dumb' || !process.stdin.isTTY) + options.noTTYOutput = options.noTTYOutput || Boolean(process.env.TERM === 'dumb' || !process.stdin.isTTY) return new cliProgress.SingleBar(options) } From 917ec3c83a2cde63e3181d5843c3e7617c60234e Mon Sep 17 00:00:00 2001 From: Cedric Hurst Date: Sat, 30 Oct 2021 16:07:11 -0500 Subject: [PATCH 2/2] adding type bindings for cli-progress --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 9a373e22..54d043c0 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "@types/chai": "^4.1.7", "@types/chai-as-promised": "^7.1.0", "@types/clean-stack": "^2.1.1", + "@types/cli-progress": "^3.4.0", "@types/extract-stack": "^2.0.0", "@types/fs-extra": "^8.1", "@types/js-yaml": "^3.12.1",