From f22211f93c5714b9c780cfbccd87e4b52ad57f3d Mon Sep 17 00:00:00 2001 From: Philipe Navarro Date: Thu, 14 May 2020 14:05:54 -0700 Subject: [PATCH] fix: add explicit table.Flags type --- package.json | 2 +- src/prompt.ts | 3 ++- src/styled/table.ts | 12 +++++++++++- yarn.lock | 8 ++++---- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index daa9362e..2d8541c9 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "fancy-test": "^1.4.1", "mocha": "^5.2.0", "ts-node": "^8.0.3", - "typescript": "^3.1.4" + "typescript": "^3.8.3" }, "engines": { "node": ">=8.0.0" diff --git a/src/prompt.ts b/src/prompt.ts index c7287a8b..639d4162 100644 --- a/src/prompt.ts +++ b/src/prompt.ts @@ -70,7 +70,8 @@ function getPrompt(name: string, type?: string, defaultValue?: string) { async function single(options: IPromptConfig): Promise { const raw = process.stdin.isRaw if (process.stdin.setRawMode) process.stdin.setRawMode(true) - const response = await normal({required: false, ...options}) + options.required = options.required ?? false + const response = await normal(options) if (process.stdin.setRawMode) process.stdin.setRawMode(Boolean(raw)) return response } diff --git a/src/styled/table.ts b/src/styled/table.ts index c0dcbcc1..1b4c123b 100644 --- a/src/styled/table.ts +++ b/src/styled/table.ts @@ -283,8 +283,18 @@ class Table { export function table(data: T[], columns: table.Columns, options: table.Options = {}) { new Table(data, columns, options).display() } + export namespace table { - export const Flags = { + export const Flags: { + columns: F.IOptionFlag; + sort: F.IOptionFlag; + filter: F.IOptionFlag; + csv: F.IFlag; + output: F.IOptionFlag; + extended: F.IFlag; + 'no-truncate': F.IFlag; + 'no-header': F.IFlag; + } = { columns: F.string({exclusive: ['extended'], description: 'only show provided columns (comma-separated)'}), sort: F.string({description: 'property to sort by (prepend \'-\' for descending)'}), filter: F.string({description: 'filter property by partial string matching, ex: name=foo'}), diff --git a/yarn.lock b/yarn.lock index 59de6707..8b15d1be 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1607,10 +1607,10 @@ type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== -typescript@^3.1.4: - version "3.5.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" - integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g== +typescript@^3.8.3: + version "3.9.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.2.tgz#64e9c8e9be6ea583c54607677dd4680a1cf35db9" + integrity sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw== universalify@^0.1.0: version "0.1.2"