From 8deb2a8c32067a3fb208d9dfef4609ee9de6859e Mon Sep 17 00:00:00 2001 From: Florian Keller Date: Thu, 20 Jun 2019 23:01:52 +0200 Subject: [PATCH] Add types for commander-remaining-args (#36148) --- .../commander-remaining-args-tests.ts | 6 +++++ types/commander-remaining-args/index.d.ts | 13 +++++++++++ types/commander-remaining-args/package.json | 6 +++++ types/commander-remaining-args/tsconfig.json | 23 +++++++++++++++++++ types/commander-remaining-args/tslint.json | 1 + 5 files changed, 49 insertions(+) create mode 100644 types/commander-remaining-args/commander-remaining-args-tests.ts create mode 100644 types/commander-remaining-args/index.d.ts create mode 100644 types/commander-remaining-args/package.json create mode 100644 types/commander-remaining-args/tsconfig.json create mode 100644 types/commander-remaining-args/tslint.json diff --git a/types/commander-remaining-args/commander-remaining-args-tests.ts b/types/commander-remaining-args/commander-remaining-args-tests.ts new file mode 100644 index 0000000000..4dcbcad13e --- /dev/null +++ b/types/commander-remaining-args/commander-remaining-args-tests.ts @@ -0,0 +1,6 @@ +import cli = require('commander'); +import getRemainingArgs = require('commander-remaining-args'); + +cli.allowUnknownOption().option('--some-flag'); + +getRemainingArgs(cli); // ['--unknown-flag', '--unknown-arg=value', '-x']) diff --git a/types/commander-remaining-args/index.d.ts b/types/commander-remaining-args/index.d.ts new file mode 100644 index 0000000000..19d53204eb --- /dev/null +++ b/types/commander-remaining-args/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for commander-remaining-args 1.2 +// Project: https://github.com/axelchalon/commander-remaining-args#readme +// Definitions by: Florian Keller +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + +import { Command } from 'commander'; + +declare function getRemainingArgs(cli: Command): string[]; + +export = getRemainingArgs; diff --git a/types/commander-remaining-args/package.json b/types/commander-remaining-args/package.json new file mode 100644 index 0000000000..2b2a046468 --- /dev/null +++ b/types/commander-remaining-args/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "commander": "^2.20.0" + } +} diff --git a/types/commander-remaining-args/tsconfig.json b/types/commander-remaining-args/tsconfig.json new file mode 100644 index 0000000000..a19d8420f1 --- /dev/null +++ b/types/commander-remaining-args/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "commander-remaining-args-tests.ts" + ] +} diff --git a/types/commander-remaining-args/tslint.json b/types/commander-remaining-args/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/commander-remaining-args/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }