File tree 2 files changed +10
-4
lines changed
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -92,10 +92,10 @@ export namespace thrownAt {
92
92
*
93
93
* @returns Assertion object.
94
94
*/
95
- export function expect < T > ( value : T , prefix ?: string ) :
96
- T extends string ? expect . StringAssertion < T > :
97
- T extends number | bigint ? expect . NumberAssertion < T > :
98
- T extends Promise < any > ? expect . PromiseAssertion < T > :
95
+ export function expect < T , TTest extends T = T > ( value : T , prefix ?: string ) :
96
+ TTest extends string ? expect . StringAssertion < T > :
97
+ TTest extends number | bigint ? expect . NumberAssertion < T > :
98
+ TTest extends Promise < any > ? expect . PromiseAssertion < T > :
99
99
expect . Assertion < T > ;
100
100
101
101
declare namespace expect {
Original file line number Diff line number Diff line change @@ -200,3 +200,9 @@ await expect.type<Promise<CustomError>>(Code.expect(typedRejection).to.reject(Cu
200
200
await expect . type < Promise < CustomError > > ( Code . expect ( typedRejection ) . rejects ( CustomError , 'Oh no!' ) ) ;
201
201
202
202
await expect . type < Promise < null > > ( Code . expect ( Promise . resolve ( true ) ) . to . not . reject ( ) ) ;
203
+
204
+ function foo ( ) : number | undefined {
205
+ return 123 ;
206
+ }
207
+
208
+ Code . expect ( foo ( ) ) . to . equal ( 123 ) ;
You can’t perform that action at this time.
0 commit comments