Skip to content

Commit

Permalink
Tweak the TS definition
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 21, 2019
1 parent 3db7d2c commit f2cb86f
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions index.d.ts
Expand Up @@ -234,30 +234,30 @@ export interface ExecaReturnBase<StdoutStderrType> {
killed: boolean;
}

export interface ExecaSyncReturnValue<StdOutErrType = string>
extends ExecaReturnBase<StdOutErrType> {
export interface ExecaSyncReturnValue<StdoutErrorType = string>
extends ExecaReturnBase<StdoutErrorType> {
/**
The exit code of the process that was run.
*/
code: number;
}

export interface ExecaReturnValue<StdOutErrType = string>
extends ExecaSyncReturnValue<StdOutErrType> {
export interface ExecaReturnValue<StdoutErrorType = string>
extends ExecaSyncReturnValue<StdoutErrorType> {
/**
The output of the process with `stdout` and `stderr` interleaved.
*/
all: StdOutErrType;
all: StdoutErrorType;

/**
Whether the process was canceled.
*/
isCanceled: boolean;
}

export interface ExecaSyncError<StdOutErrType = string>
export interface ExecaSyncError<StdoutErrorType = string>
extends Error,
ExecaReturnBase<StdOutErrType> {
ExecaReturnBase<StdoutErrorType> {
/**
The error message.
*/
Expand All @@ -269,27 +269,25 @@ export interface ExecaSyncError<StdOutErrType = string>
code: number | string;
}

export interface ExecaError<StdOutErrType = string>
extends ExecaSyncError<StdOutErrType> {
export interface ExecaError<StdoutErrorType = string>
extends ExecaSyncError<StdoutErrorType> {
/**
The output of the process with `stdout` and `stderr` interleaved.
*/
all: StdOutErrType;
all: StdoutErrorType;

/**
Whether the process was canceled.
*/
isCanceled: boolean;
}

export interface ExecaChildPromise<StdOutErrType> {
export interface ExecaChildPromise<StdoutErrorType> {
catch<ResultType = never>(
onRejected?:
| ((
reason: ExecaError<StdOutErrType>
) => ResultType | PromiseLike<ResultType>)
| ((reason: ExecaError<StdoutErrorType>) => ResultType | PromiseLike<ResultType>)
| null
): Promise<ExecaReturnValue<StdOutErrType> | ResultType>;
): Promise<ExecaReturnValue<StdoutErrorType> | ResultType>;

/**
Cancel the subprocess.
Expand All @@ -299,9 +297,9 @@ export interface ExecaChildPromise<StdOutErrType> {
cancel(): void;
}

export type ExecaChildProcess<StdOutErrType = string> = ChildProcess &
ExecaChildPromise<StdOutErrType> &
Promise<ExecaReturnValue<StdOutErrType>>;
export type ExecaChildProcess<StdoutErrorType = string> = ChildProcess &
ExecaChildPromise<StdoutErrorType> &
Promise<ExecaReturnValue<StdoutErrorType>>;

declare const execa: {
/**
Expand Down

0 comments on commit f2cb86f

Please sign in to comment.