Skip to content
Myr

Fix types of `reject` option (#688)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by GitHub · parent ae64408 · Browse files · 2 files+32 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+32 added−4 removed

  • other:+32 added−4 removed

2 files+32 added−4 removed

modified:index.d.ts+8 added-4 removed
611 unmodified lines
612 */613 all: AllOutput<OptionsType>;614});615616export type ExecaReturnValue<OptionsType extends Options = Options> = ExecaCommonReturnValue<false, OptionsType>;617export type ExecaSyncReturnValue<OptionsType extends SyncOptions = SyncOptions> = ExecaCommonReturnValue<true, OptionsType>;616export type ExecaReturnValue<OptionsType extends Options = Options> = ExecaCommonReturnValue<false, OptionsType> & ErrorUnlessReject<OptionsType['reject']>;617export type ExecaSyncReturnValue<OptionsType extends SyncOptions = SyncOptions> = ExecaCommonReturnValue<true, OptionsType> & ErrorUnlessReject<OptionsType['reject']>;618619type ErrorUnlessReject<RejectOption extends CommonOptions['reject']> = RejectOption extends false620 ? Partial<ExecaCommonError>621 : {};622623type ExecaCommonError = {624 /**625 Error message when the child process failed to run. In addition to the underlying error message, it also contains some information related to why the child process errored.626
13 unmodified lines
640 */641 originalMessage?: string;642} & Error;643640export type ExecaError<OptionsType extends Options = Options> = ExecaCommonError & ExecaReturnValue<OptionsType>;641export type ExecaSyncError<OptionsType extends SyncOptions = SyncOptions> = ExecaCommonError & ExecaSyncReturnValue<OptionsType>;644export type ExecaError<OptionsType extends Options = Options> = ExecaCommonReturnValue<false, OptionsType> & ExecaCommonError;645export type ExecaSyncError<OptionsType extends SyncOptions = SyncOptions> = ExecaCommonReturnValue<true, OptionsType> & ExecaCommonError;646647export type KillOptions = {648 /**649 Milliseconds to wait for the child process to terminate before sending `SIGKILL`.
551 unmodified lines
modified:index.test-d.ts+24 added
368 unmodified lines
369 expectType<undefined>(streamStderrError.stderr);370 expectType<string>(streamStderrError.all);371}372373const rejectsResult = await execa('unicorns');374expectError(rejectsResult.stack);375expectError(rejectsResult.message);376expectError(rejectsResult.shortMessage);377expectError(rejectsResult.originalMessage);378379const noRejectsResult = await execa('unicorns', {reject: false});380expectType<string | undefined>(noRejectsResult.stack);381expectType<string | undefined>(noRejectsResult.message);382expectType<string | undefined>(noRejectsResult.shortMessage);383expectType<string | undefined>(noRejectsResult.originalMessage);384385try {386 const unicornsResult = execaSync('unicorns');387388 expectAssignable<ExecaSyncReturnValue>(unicornsResult);
140 unmodified lines
529 expectType<undefined>(numberStderrError.stderr);530 expectError(numberStderrError.all);531}532533const rejectsSyncResult = execaSync('unicorns');534expectError(rejectsSyncResult.stack);535expectError(rejectsSyncResult.message);536expectError(rejectsSyncResult.shortMessage);537expectError(rejectsSyncResult.originalMessage);538539const noRejectsSyncResult = execaSync('unicorns', {reject: false});540expectType<string | undefined>(noRejectsSyncResult.stack);541expectType<string | undefined>(noRejectsSyncResult.message);542expectType<string | undefined>(noRejectsSyncResult.shortMessage);543expectType<string | undefined>(noRejectsSyncResult.originalMessage);544545const stringGenerator = function * () {546 yield '';547};548
536 unmodified lines