Skip to content
Myr

template.test-d.ts

This file

Path

test-d/methods/template.test-d.ts

18 lines · 962 bytes · TypeScript

Last changed by

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

History of this file

Take it

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 1why, one step back
1import {expectTypeOf} from 'nz';

Export `TemplateExpression` type (#1049)ehmickybefore adoption2d84752

lines 2–6why, one step back
2import {execa, type TemplateExpression} from '../../index.js';
34const stringArray = ['foo', 'bar'] as const;5const numberArray = [1, 2] as const;6

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 7–12why, one step back
7expectTypeOf<'unicorns'>().toBeAssignableTo<TemplateExpression>();
8expectTypeOf<1>().toBeAssignableTo<TemplateExpression>();9expectTypeOf(stringArray).toBeAssignableTo<TemplateExpression>();10expectTypeOf(numberArray).toBeAssignableTo<TemplateExpression>();11expectTypeOf(false.toString()).toBeAssignableTo<TemplateExpression>();12expectTypeOf<false>().not.toBeAssignableTo<TemplateExpression>();

Export `TemplateExpression` type (#1049)ehmickybefore adoption2d84752

line 13why, one step back
13

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 14–18why, one step back
14expectTypeOf(await execa`echo foo`).toBeAssignableTo<TemplateExpression>();
15expectTypeOf(await execa({reject: false})`echo foo`).toBeAssignableTo<TemplateExpression>();16expectTypeOf(execa`echo foo`).not.toBeAssignableTo<TemplateExpression>();17[await execa`echo foo`, 'bar'] satisfies TemplateExpression;18expectTypeOf([execa`echo foo`, 'bar']).not.toBeAssignableTo<TemplateExpression>();