Add types for concurrently (#38580)

This commit is contained in:
Michael 2019-09-26 02:21:28 +08:00 committed by Ben Lichtman
parent 7e6c90c6e2
commit 95fa61dc89
4 changed files with 78 additions and 0 deletions

View File

@ -0,0 +1,20 @@
import * as concurrently from 'concurrently';
concurrently(['echo foo']); // $ExpectType Promise<null>
// $ExpectType Promise<null>
concurrently(
[
'echo foo',
{
command: 'echo bar',
name: 'bar',
prefixColor: 'yellow',
},
],
{
prefix: 'foo',
killOthers: ['success'],
},
);
concurrently('foo'); // $ExpectError

34
types/concurrently/index.d.ts vendored Normal file
View File

@ -0,0 +1,34 @@
// Type definitions for concurrently 4.1
// Project: https://github.com/kimmobrunfeldt/concurrently#readme
// Definitions by: Michael B. <https://github.com/Blasz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export = concurrently;
declare function concurrently(
commands: Array<concurrently.CommandObj | string>,
options?: concurrently.Options,
): Promise<null>;
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;
}
}

View File

@ -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"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }