script.test-d.ts
This file
Path
test-d/methods/script.test-d.ts
56 lines · 2.6 KiB · TypeScript
Last changed by
Rename some types (#1009)ehmickybefore adoption2ef9186
History of this fileTake it
Split type files (#978)ehmickybefore adoption0bd0f0d
line 1why, one step back1import {expectType, expectError, expectAssignable} from 'tsd';Rename some types (#1009)ehmickybefore adoption2ef9186
line 2why, one step back2import {$, type Result, type ResultPromise} from '../../index.js';Split type files (#978)ehmickybefore adoption0bd0f0d
lines 3–9why, one step back34const fileUrl = new URL('file:///test');5const stringArray = ['foo', 'bar'] as const;67expectError($());8expectError($(true));9expectError($(['unicorns', 'arg']));Rename some types (#1009)ehmickybefore adoption2ef9186
lines 10–11why, one step back10expectAssignable<ResultPromise>($('unicorns'));11expectAssignable<ResultPromise>($(fileUrl));Split type files (#978)ehmickybefore adoption0bd0f0d
line 12why, one step back12Rename some types (#1009)ehmickybefore adoption2ef9186
lines 13–14why, one step back13expectAssignable<ResultPromise>($('unicorns', []));14expectAssignable<ResultPromise>($('unicorns', ['foo']));Split type files (#978)ehmickybefore adoption0bd0f0d
lines 15–17why, one step back15expectError($('unicorns', 'foo'));16expectError($('unicorns', [true]));17Rename some types (#1009)ehmickybefore adoption2ef9186
lines 18–19why, one step back18expectAssignable<ResultPromise>($('unicorns', {}));19expectAssignable<ResultPromise>($('unicorns', [], {}));Split type files (#978)ehmickybefore adoption0bd0f0d
lines 20–22why, one step back20expectError($('unicorns', [], []));21expectError($('unicorns', {other: true}));22Rename some types (#1009)ehmickybefore adoption2ef9186
lines 23–25why, one step back23expectAssignable<ResultPromise>($`unicorns`);24expectType<Result<{}>>(await $('unicorns'));25expectType<Result<{}>>(await $`unicorns`);Split type files (#978)ehmickybefore adoption0bd0f0d
lines 26–27why, one step back2627expectAssignable<typeof $>($({}));Rename some types (#1009)ehmickybefore adoption2ef9186
lines 28–29why, one step back28expectAssignable<ResultPromise>($({})('unicorns'));29expectAssignable<ResultPromise>($({})`unicorns`);Split type files (#978)ehmickybefore adoption0bd0f0d
lines 30–43why, one step back3031expectAssignable<{stdout: string}>(await $('unicorns'));32expectAssignable<{stdout: Uint8Array}>(await $('unicorns', {encoding: 'buffer'}));33expectAssignable<{stdout: string}>(await $('unicorns', ['foo']));34expectAssignable<{stdout: Uint8Array}>(await $('unicorns', ['foo'], {encoding: 'buffer'}));35expectAssignable<{stdout: string}>(await $({})('unicorns'));36expectAssignable<{stdout: Uint8Array}>(await $({encoding: 'buffer'})('unicorns'));37expectAssignable<{stdout: Uint8Array}>(await $({})({encoding: 'buffer'})('unicorns'));38expectAssignable<{stdout: Uint8Array}>(await $({encoding: 'buffer'})({})('unicorns'));39expectAssignable<{stdout: string}>(await $({})`unicorns`);40expectAssignable<{stdout: Uint8Array}>(await $({encoding: 'buffer'})`unicorns`);41expectAssignable<{stdout: Uint8Array}>(await $({})({encoding: 'buffer'})`unicorns`);42expectAssignable<{stdout: Uint8Array}>(await $({encoding: 'buffer'})({})`unicorns`);43Rename some types (#1009)ehmickybefore adoption2ef9186
lines 44–50why, one step back44expectType<Result<{}>>(await $`${'unicorns'}`);45expectType<Result<{}>>(await $`unicorns ${'foo'}`);46expectType<Result<{}>>(await $`unicorns ${'foo'} ${'bar'}`);47expectType<Result<{}>>(await $`unicorns ${1}`);48expectType<Result<{}>>(await $`unicorns ${stringArray}`);49expectType<Result<{}>>(await $`unicorns ${[1, 2]}`);50expectType<Result<{}>>(await $`unicorns ${false.toString()}`);Split type files (#978)ehmickybefore adoption0bd0f0d
lines 51–52why, one step back51expectError(await $`unicorns ${false}`);52Rename some types (#1009)ehmickybefore adoption2ef9186
line 53why, one step back53expectType<Result<{}>>(await $`unicorns ${await $`echo foo`}`);Split type files (#978)ehmickybefore adoption0bd0f0d
line 54why, one step back54expectError(await $`unicorns ${$`echo foo`}`);Rename some types (#1009)ehmickybefore adoption2ef9186
line 55why, one step back55expectType<Result<{}>>(await $`unicorns ${[await $`echo foo`, 'bar']}`);Split type files (#978)ehmickybefore adoption0bd0f0d
line 56why, one step back56expectError(await $`unicorns ${[$`echo foo`, 'bar']}`);