diff --git a/types/concurrently/concurrently-tests.ts b/types/concurrently/concurrently-tests.ts new file mode 100644 index 0000000000..240eb5c61b --- /dev/null +++ b/types/concurrently/concurrently-tests.ts @@ -0,0 +1,20 @@ +import * as concurrently from 'concurrently'; + +concurrently(['echo foo']); // $ExpectType Promise +// $ExpectType Promise +concurrently( + [ + 'echo foo', + { + command: 'echo bar', + name: 'bar', + prefixColor: 'yellow', + }, + ], + { + prefix: 'foo', + killOthers: ['success'], + }, +); + +concurrently('foo'); // $ExpectError diff --git a/types/concurrently/index.d.ts b/types/concurrently/index.d.ts new file mode 100644 index 0000000000..a608bc0be9 --- /dev/null +++ b/types/concurrently/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for concurrently 4.1 +// Project: https://github.com/kimmobrunfeldt/concurrently#readme +// Definitions by: Michael B. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export = concurrently; + +declare function concurrently( + commands: Array, + options?: concurrently.Options, +): Promise; + +declare namespace concurrently { + interface CommandObj { + command: string; + name?: string; + prefixColor?: string; + } + interface Options { + defaultInputTarget?: number; + inputStream?: NodeJS.ReadableStream; + killOthers?: Array<'success' | 'failure'>; + outputStream?: NodeJS.WritableStream; + prefix?: 'index' | 'pid' | 'time' | 'command' | 'name' | 'none' | string; + prefixLength?: number; + raw?: boolean; + restartTries?: number; + restartDelay?: number; + successCondition?: 'first' | 'last'; + timestampFormat?: string; + } +} diff --git a/types/concurrently/tsconfig.json b/types/concurrently/tsconfig.json new file mode 100644 index 0000000000..505723cd9a --- /dev/null +++ b/types/concurrently/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", + "concurrently-tests.ts" + ] +} diff --git a/types/concurrently/tslint.json b/types/concurrently/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/concurrently/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }