1- import { expectType , expectError } from 'tsd' ;
2- import { execa , execaSync } from '../../index.js' ;
1+ import { expectType , expectError , expectAssignable } from 'tsd' ;
2+ import {
3+ type Result ,
4+ type SyncResult ,
5+ execa ,
6+ execaSync ,
7+ } from '../../index.js' ;
38
49const rejectsResult = await execa ( 'unicorns' ) ;
10+ expectAssignable < Result > ( rejectsResult ) ;
511expectError ( rejectsResult . stack ?. toString ( ) ) ;
612expectError ( rejectsResult . message ?. toString ( ) ) ;
713expectError ( rejectsResult . shortMessage ?. toString ( ) ) ;
@@ -10,6 +16,7 @@ expectError(rejectsResult.code?.toString());
1016expectError ( rejectsResult . cause ?. valueOf ( ) ) ;
1117
1218const noRejectsResult = await execa ( 'unicorns' , { reject : false } ) ;
19+ expectAssignable < Result > ( noRejectsResult ) ;
1320expectType < string | undefined > ( noRejectsResult . stack ) ;
1421expectType < string | undefined > ( noRejectsResult . message ) ;
1522expectType < string | undefined > ( noRejectsResult . shortMessage ) ;
@@ -18,6 +25,7 @@ expectType<string | undefined>(noRejectsResult.code);
1825expectType < unknown > ( noRejectsResult . cause ) ;
1926
2027const rejectsSyncResult = execaSync ( 'unicorns' ) ;
28+ expectAssignable < SyncResult > ( rejectsSyncResult ) ;
2129expectError ( rejectsSyncResult . stack ?. toString ( ) ) ;
2230expectError ( rejectsSyncResult . message ?. toString ( ) ) ;
2331expectError ( rejectsSyncResult . shortMessage ?. toString ( ) ) ;
@@ -26,6 +34,7 @@ expectError(rejectsSyncResult.code?.toString());
2634expectError ( rejectsSyncResult . cause ?. valueOf ( ) ) ;
2735
2836const noRejectsSyncResult = execaSync ( 'unicorns' , { reject : false } ) ;
37+ expectAssignable < SyncResult > ( noRejectsSyncResult ) ;
2938expectType < string | undefined > ( noRejectsSyncResult . stack ) ;
3039expectType < string | undefined > ( noRejectsSyncResult . message ) ;
3140expectType < string | undefined > ( noRejectsSyncResult . shortMessage ) ;
0 commit comments