Skip to content
Myr

command.test-d.ts

This file

Path

test-d/methods/command.test-d.ts

100 lines · 5.2 KiB · TypeScript

Last changed by

Rename some types (#1009)ehmickybefore adoption2ef9186

History of this file

Take it

Split type files (#978)ehmickybefore adoption0bd0f0d

line 1why, one step back
1import {expectType, expectError, expectAssignable} from 'tsd';

Upgrade xo (#980)ehmickybefore adoptionccfa412

lines 2–4why, one step back
2import {
3 execaCommand,4 execaCommandSync,

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 5–7why, one step back
5 type Result,
6 type ResultPromise,7 type SyncResult,

Upgrade xo (#980)ehmickybefore adoptionccfa412

line 8why, one step back
8} from '../../index.js';

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 9–15why, one step back
9
10const fileUrl = new URL('file:///test');11const stringArray = ['foo', 'bar'] as const;1213expectError(execaCommand());14expectError(execaCommand(true));15expectError(execaCommand(['unicorns', 'arg']));

Rename some types (#1009)ehmickybefore adoption2ef9186

line 16why, one step back
16expectAssignable<ResultPromise>(execaCommand('unicorns'));

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 17–23why, one step back
17expectError(execaCommand(fileUrl));
1819expectError(execaCommand('unicorns', []));20expectError(execaCommand('unicorns', ['foo']));21expectError(execaCommand('unicorns', 'foo'));22expectError(execaCommand('unicorns', [true]));23

Rename some types (#1009)ehmickybefore adoption2ef9186

line 24why, one step back
24expectAssignable<ResultPromise>(execaCommand('unicorns', {}));

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 25–28why, one step back
25expectError(execaCommand('unicorns', [], {}));
26expectError(execaCommand('unicorns', [], []));27expectError(execaCommand('unicorns', {other: true}));28

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 29–31why, one step back
29expectAssignable<ResultPromise>(execaCommand`unicorns`);
30expectType<Result<{}>>(await execaCommand('unicorns'));31expectType<Result<{}>>(await execaCommand`unicorns`);

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 32–33why, one step back
32
33expectAssignable<typeof execaCommand>(execaCommand({}));

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 34–35why, one step back
34expectAssignable<ResultPromise>(execaCommand({})('unicorns'));
35expectAssignable<ResultPromise>(execaCommand({})`unicorns`);

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 36–47why, one step back
36
37expectAssignable<{stdout: string}>(await execaCommand('unicorns'));38expectAssignable<{stdout: Uint8Array}>(await execaCommand('unicorns', {encoding: 'buffer'}));39expectAssignable<{stdout: string}>(await execaCommand({})('unicorns'));40expectAssignable<{stdout: Uint8Array}>(await execaCommand({encoding: 'buffer'})('unicorns'));41expectAssignable<{stdout: Uint8Array}>(await execaCommand({})({encoding: 'buffer'})('unicorns'));42expectAssignable<{stdout: Uint8Array}>(await execaCommand({encoding: 'buffer'})({})('unicorns'));43expectAssignable<{stdout: string}>(await execaCommand({})`unicorns`);44expectAssignable<{stdout: Uint8Array}>(await execaCommand({encoding: 'buffer'})`unicorns`);45expectAssignable<{stdout: Uint8Array}>(await execaCommand({})({encoding: 'buffer'})`unicorns`);46expectAssignable<{stdout: Uint8Array}>(await execaCommand({encoding: 'buffer'})({})`unicorns`);47

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 48–49why, one step back
48expectType<Result<{}>>(await execaCommand`${'unicorns'}`);
49expectType<Result<{}>>(await execaCommand`unicorns ${'foo'}`);

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 50–53why, one step back
50expectError(await execaCommand`unicorns ${'foo'} ${'bar'}`);
51expectError(await execaCommand`unicorns ${1}`);52expectError(await execaCommand`unicorns ${stringArray}`);53expectError(await execaCommand`unicorns ${[1, 2]}`);

Rename some types (#1009)ehmickybefore adoption2ef9186

line 54why, one step back
54expectType<Result<{}>>(await execaCommand`unicorns ${false.toString()}`);

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 55–64why, one step back
55expectError(await execaCommand`unicorns ${false}`);
5657expectError(await execaCommand`unicorns ${await execaCommand`echo foo`}`);58expectError(await execaCommand`unicorns ${execaCommand`echo foo`}`);59expectError(await execaCommand`unicorns ${[await execaCommand`echo foo`, 'bar']}`);60expectError(await execaCommand`unicorns ${[execaCommand`echo foo`, 'bar']}`);6162expectError(execaCommandSync());63expectError(execaCommandSync(true));64expectError(execaCommandSync(['unicorns', 'arg']));

Rename some types (#1009)ehmickybefore adoption2ef9186

line 65why, one step back
65expectType<SyncResult<{}>>(execaCommandSync('unicorns'));

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 66–68why, one step back
66expectError(execaCommandSync(fileUrl));
67expectError(execaCommandSync('unicorns', []));68expectError(execaCommandSync('unicorns', ['foo']));

Rename some types (#1009)ehmickybefore adoption2ef9186

line 69why, one step back
69expectType<SyncResult<{}>>(execaCommandSync('unicorns', {}));

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 70–74why, one step back
70expectError(execaCommandSync('unicorns', [], {}));
71expectError(execaCommandSync('unicorns', 'foo'));72expectError(execaCommandSync('unicorns', [true]));73expectError(execaCommandSync('unicorns', [], []));74expectError(execaCommandSync('unicorns', {other: true}));

Rename some types (#1009)ehmickybefore adoption2ef9186

line 75why, one step back
75expectType<SyncResult<{}>>(execaCommandSync`unicorns`);

Split type files (#978)ehmickybefore adoption0bd0f0d

line 76why, one step back
76expectAssignable<typeof execaCommandSync>(execaCommandSync({}));

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 77–80why, one step back
77expectType<SyncResult<{}>>(execaCommandSync({})('unicorns'));
78expectType<SyncResult<{}>>(execaCommandSync({})`unicorns`);79expectType<SyncResult<{}>>(execaCommandSync('unicorns'));80expectType<SyncResult<{}>>(execaCommandSync`unicorns`);

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 81–90why, one step back
81expectAssignable<{stdout: string}>(execaCommandSync('unicorns'));
82expectAssignable<{stdout: Uint8Array}>(execaCommandSync('unicorns', {encoding: 'buffer'}));83expectAssignable<{stdout: string}>(execaCommandSync({})('unicorns'));84expectAssignable<{stdout: Uint8Array}>(execaCommandSync({encoding: 'buffer'})('unicorns'));85expectAssignable<{stdout: Uint8Array}>(execaCommandSync({})({encoding: 'buffer'})('unicorns'));86expectAssignable<{stdout: Uint8Array}>(execaCommandSync({encoding: 'buffer'})({})('unicorns'));87expectAssignable<{stdout: string}>(execaCommandSync({})`unicorns`);88expectAssignable<{stdout: Uint8Array}>(execaCommandSync({encoding: 'buffer'})`unicorns`);89expectAssignable<{stdout: Uint8Array}>(execaCommandSync({})({encoding: 'buffer'})`unicorns`);90expectAssignable<{stdout: Uint8Array}>(execaCommandSync({encoding: 'buffer'})({})`unicorns`);

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 91–92why, one step back
91expectType<SyncResult<{}>>(execaCommandSync`${'unicorns'}`);
92expectType<SyncResult<{}>>(execaCommandSync`unicorns ${'foo'}`);

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 93–98why, one step back
93expectError(execaCommandSync`unicorns ${'foo'} ${'bar'}`);
94expectError(execaCommandSync`unicorns ${1}`);95expectError(execaCommandSync`unicorns ${stringArray}`);96expectError(execaCommandSync`unicorns ${[1, 2]}`);97expectError(execaCommandSync`unicorns ${execaCommandSync`echo foo`}`);98expectError(execaCommandSync`unicorns ${[execaCommandSync`echo foo`, 'bar']}`);

Rename some types (#1009)ehmickybefore adoption2ef9186

line 99why, one step back
99expectType<SyncResult<{}>>(execaCommandSync`unicorns ${false.toString()}`);

Split type files (#978)ehmickybefore adoption0bd0f0d

line 100why, one step back
100expectError(execaCommandSync`unicorns ${false}`);