Skip to content
Myr

script-sync.test-d.ts

This file

Path

test-d/methods/script-sync.test-d.ts

65 lines · 3.3 KiB · TypeScript

Last changed by

Fix type of result when using the `reject: false` option (#1046)ehmickybefore adoptionab2a9ed

History of this file

Take it

The walk stopped after 200 commits: lines older than c8a6ed7 point at it.

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

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

Rename some types (#1009)ehmickybefore adoption2ef9186

line 2why, one step back
2import {$, type SyncResult} from '../../index.js';

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 3–9why, one step back
3
4const fileUrl = new URL('file:///test');5const stringArray = ['foo', 'bar'] as const;67expectError($.sync());8expectError($.sync(true));9expectError($.sync(['unicorns', 'arg']));

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 10–11why, one step back
10expectType<SyncResult<{}>>($.sync('unicorns'));
11expectType<SyncResult<{}>>($.sync(fileUrl));

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 12why, one step back
12

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 13–14why, one step back
13expectType<SyncResult<{}>>($.sync('unicorns', []));
14expectType<SyncResult<{}>>($.sync('unicorns', ['foo']));

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 15–17why, one step back
15expectError($.sync('unicorns', 'foo'));
16expectError($.sync('unicorns', [true]));17

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 18–19why, one step back
18expectType<SyncResult<{}>>($.sync('unicorns', {}));
19expectType<SyncResult<{}>>($.sync('unicorns', [], {}));

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 20–22why, one step back
20expectError($.sync('unicorns', [], []));
21expectError($.sync('unicorns', {other: true}));22

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 23–25why, one step back
23expectType<SyncResult<{}>>($.sync`unicorns`);
24expectType<SyncResult<{}>>($.sync('unicorns'));25expectType<SyncResult<{}>>($.sync`unicorns`);

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 26–27why, one step back
26
27expectAssignable<typeof $.sync>($.sync({}));

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 28–31why, one step back
28expectType<SyncResult<{}>>($.sync({})('unicorns'));
29expectType<SyncResult<{}>>($({}).sync('unicorns'));30expectType<SyncResult<{}>>($.sync({})`unicorns`);31expectType<SyncResult<{}>>($({}).sync`unicorns`);

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 32–53why, one step back
32
33expectAssignable<{stdout: string}>($.sync('unicorns'));34expectAssignable<{stdout: Uint8Array}>($.sync('unicorns', {encoding: 'buffer'}));35expectAssignable<{stdout: string}>($.sync('unicorns', ['foo']));36expectAssignable<{stdout: Uint8Array}>($.sync('unicorns', ['foo'], {encoding: 'buffer'}));37expectAssignable<{stdout: string}>($.sync({})('unicorns'));38expectAssignable<{stdout: string}>($({}).sync('unicorns'));39expectAssignable<{stdout: Uint8Array}>($.sync({encoding: 'buffer'})('unicorns'));40expectAssignable<{stdout: Uint8Array}>($({encoding: 'buffer'}).sync('unicorns'));41expectAssignable<{stdout: Uint8Array}>($.sync({})({encoding: 'buffer'})('unicorns'));42expectAssignable<{stdout: Uint8Array}>($({})({encoding: 'buffer'}).sync('unicorns'));43expectAssignable<{stdout: Uint8Array}>($.sync({encoding: 'buffer'})({})('unicorns'));44expectAssignable<{stdout: Uint8Array}>($({encoding: 'buffer'}).sync({})('unicorns'));45expectAssignable<{stdout: string}>($.sync({})`unicorns`);46expectAssignable<{stdout: string}>($({}).sync`unicorns`);47expectAssignable<{stdout: Uint8Array}>($.sync({encoding: 'buffer'})`unicorns`);48expectAssignable<{stdout: Uint8Array}>($({encoding: 'buffer'}).sync`unicorns`);49expectAssignable<{stdout: Uint8Array}>($.sync({})({encoding: 'buffer'})`unicorns`);50expectAssignable<{stdout: Uint8Array}>($({})({encoding: 'buffer'}).sync`unicorns`);51expectAssignable<{stdout: Uint8Array}>($.sync({encoding: 'buffer'})({})`unicorns`);52expectAssignable<{stdout: Uint8Array}>($({encoding: 'buffer'}).sync({})`unicorns`);53

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 54–60why, one step back
54expectType<SyncResult<{}>>($.sync`${'unicorns'}`);
55expectType<SyncResult<{}>>($.sync`unicorns ${'foo'}`);56expectType<SyncResult<{}>>($.sync`unicorns ${'foo'} ${'bar'}`);57expectType<SyncResult<{}>>($.sync`unicorns ${1}`);58expectType<SyncResult<{}>>($.sync`unicorns ${stringArray}`);59expectType<SyncResult<{}>>($.sync`unicorns ${[1, 2]}`);60expectType<SyncResult<{}>>($.sync`unicorns ${false.toString()}`);

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 61–62why, one step back
61expectError($.sync`unicorns ${false}`);
62

Rename some types (#1009)ehmickybefore adoption2ef9186

line 63why, one step back
63expectType<SyncResult<{}>>($.sync`unicorns ${$.sync`echo foo`}`);

Fix type of result when using the `reject: false` option (#1046)ehmickybefore adoptionab2a9ed

line 64why, one step back
64expectType<SyncResult<{}>>($.sync`unicorns ${$.sync({reject: false})`echo foo`}`);

Rename some types (#1009)ehmickybefore adoption2ef9186

line 65why, one step back
65expectType<SyncResult<{}>>($.sync`unicorns ${[$.sync`echo foo`, 'bar']}`);