script-s.test-d.ts
This file
Path
test-d/methods/script-s.test-d.ts
64 lines · 3.1 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 SyncResult} 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($.s());8expectError($.s(true));9expectError($.s(['unicorns', 'arg']));Rename some types (#1009)ehmickybefore adoption2ef9186
lines 10–11why, one step back10expectType<SyncResult<{}>>($.s('unicorns'));11expectType<SyncResult<{}>>($.s(fileUrl));Split type files (#978)ehmickybefore adoption0bd0f0d
line 12why, one step back12Rename some types (#1009)ehmickybefore adoption2ef9186
lines 13–14why, one step back13expectType<SyncResult<{}>>($.s('unicorns', []));14expectType<SyncResult<{}>>($.s('unicorns', ['foo']));Split type files (#978)ehmickybefore adoption0bd0f0d
lines 15–17why, one step back15expectError($.s('unicorns', 'foo'));16expectError($.s('unicorns', [true]));17Rename some types (#1009)ehmickybefore adoption2ef9186
lines 18–19why, one step back18expectType<SyncResult<{}>>($.s('unicorns', {}));19expectType<SyncResult<{}>>($.s('unicorns', [], {}));Split type files (#978)ehmickybefore adoption0bd0f0d
lines 20–22why, one step back20expectError($.s('unicorns', [], []));21expectError($.s('unicorns', {other: true}));22Rename some types (#1009)ehmickybefore adoption2ef9186
lines 23–25why, one step back23expectType<SyncResult<{}>>($.s`unicorns`);24expectType<SyncResult<{}>>($.s('unicorns'));25expectType<SyncResult<{}>>($.s`unicorns`);Split type files (#978)ehmickybefore adoption0bd0f0d
lines 26–27why, one step back2627expectAssignable<typeof $.s>($.s({}));Rename some types (#1009)ehmickybefore adoption2ef9186
lines 28–31why, one step back28expectType<SyncResult<{}>>($.s({})('unicorns'));29expectType<SyncResult<{}>>($({}).s('unicorns'));30expectType<SyncResult<{}>>($.s({})`unicorns`);31expectType<SyncResult<{}>>($({}).s`unicorns`);Split type files (#978)ehmickybefore adoption0bd0f0d
lines 32–53why, one step back3233expectAssignable<{stdout: string}>($.s('unicorns'));34expectAssignable<{stdout: Uint8Array}>($.s('unicorns', {encoding: 'buffer'}));35expectAssignable<{stdout: string}>($.s('unicorns', ['foo']));36expectAssignable<{stdout: Uint8Array}>($.s('unicorns', ['foo'], {encoding: 'buffer'}));37expectAssignable<{stdout: string}>($.s({})('unicorns'));38expectAssignable<{stdout: string}>($({}).s('unicorns'));39expectAssignable<{stdout: Uint8Array}>($.s({encoding: 'buffer'})('unicorns'));40expectAssignable<{stdout: Uint8Array}>($({encoding: 'buffer'}).s('unicorns'));41expectAssignable<{stdout: Uint8Array}>($.s({})({encoding: 'buffer'})('unicorns'));42expectAssignable<{stdout: Uint8Array}>($({})({encoding: 'buffer'}).s('unicorns'));43expectAssignable<{stdout: Uint8Array}>($.s({encoding: 'buffer'})({})('unicorns'));44expectAssignable<{stdout: Uint8Array}>($({encoding: 'buffer'}).s({})('unicorns'));45expectAssignable<{stdout: string}>($.s({})`unicorns`);46expectAssignable<{stdout: string}>($({}).s`unicorns`);47expectAssignable<{stdout: Uint8Array}>($.s({encoding: 'buffer'})`unicorns`);48expectAssignable<{stdout: Uint8Array}>($({encoding: 'buffer'}).s`unicorns`);49expectAssignable<{stdout: Uint8Array}>($.s({})({encoding: 'buffer'})`unicorns`);50expectAssignable<{stdout: Uint8Array}>($({})({encoding: 'buffer'}).s`unicorns`);51expectAssignable<{stdout: Uint8Array}>($.s({encoding: 'buffer'})({})`unicorns`);52expectAssignable<{stdout: Uint8Array}>($({encoding: 'buffer'}).s({})`unicorns`);53Rename some types (#1009)ehmickybefore adoption2ef9186
lines 54–60why, one step back54expectType<SyncResult<{}>>($.s`${'unicorns'}`);55expectType<SyncResult<{}>>($.s`unicorns ${'foo'}`);56expectType<SyncResult<{}>>($.s`unicorns ${'foo'} ${'bar'}`);57expectType<SyncResult<{}>>($.s`unicorns ${1}`);58expectType<SyncResult<{}>>($.s`unicorns ${stringArray}`);59expectType<SyncResult<{}>>($.s`unicorns ${[1, 2]}`);60expectType<SyncResult<{}>>($.s`unicorns ${false.toString()}`);Split type files (#978)ehmickybefore adoption0bd0f0d
lines 61–62why, one step back61expectError($.s`unicorns ${false}`);62Rename some types (#1009)ehmickybefore adoption2ef9186
lines 63–64why, one step back63expectType<SyncResult<{}>>($.s`unicorns ${$.s`echo foo`}`);64expectType<SyncResult<{}>>($.s`unicorns ${[$.s`echo foo`, 'bar']}`);