result-all.test-d.ts
This file
Path
test-d/return/result-all.test-d.ts
31 lines · 963 bytes · TypeScript
Last changed by
Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
History of this fileTake it
1234567891011121314151617181920212223242526272829303132import {expectTypeOf} from 'nz';import { execa, execaSync, type ExecaError, type ExecaSyncError,} from '../../index.js';
const allResult = await execa('unicorns', {all: true});expectTypeOf(allResult.all).toBe<string>();
const noAllResult = await execa('unicorns');expectTypeOf(noAllResult.all).toBe<undefined>();
const allResultSync = execaSync('unicorns', {all: true});expectTypeOf(allResultSync.all).toBe<string>();
const noAllResultSync = execaSync('unicorns');expectTypeOf(noAllResultSync.all).toBe<undefined>();
const allError = new Error('.') as ExecaError<{all: true}>;expectTypeOf(allError.all).toBe<string>();
const noAllError = new Error('.') as ExecaError<{}>;expectTypeOf(noAllError.all).toBe<undefined>();
const allErrorSync = new Error('.') as ExecaError<{all: true}>;expectTypeOf(allErrorSync.all).toBe<string>();
const noAllErrorSync = new Error('.') as ExecaSyncError<{}>;expectTypeOf(noAllErrorSync.all).toBe<undefined>();