@@ -154,8 +154,11 @@ describe("ok input", () => {
154154
155155 test ( "unwrapping error throws" , ( ) => {
156156 try {
157- // @ts -expect-error Test
158- RsResult . unwrapErr ( inputResult ) ;
157+ const result = RsResult . unwrapErr ( inputResult ) ;
158+
159+ expectTypeOf ( result ) . toMatchTypeOf < never > ( ) ;
160+
161+ // Ensure that unwrapErr throws
159162 expect . fail ( "Should have thrown" ) ;
160163 } catch ( e ) {
161164 expect ( e ) . toStrictEqual ( new Error ( `Unwrapping an ok result: 123` ) ) ;
@@ -249,7 +252,11 @@ describe("err input", () => {
249252
250253 test ( "unwrapping throws" , ( ) => {
251254 try {
252- RsResult . unwrap ( inputResult ) ;
255+ const result = RsResult . unwrap ( inputResult ) ;
256+
257+ expectTypeOf ( result ) . toMatchTypeOf < never > ( ) ;
258+
259+ // Ensure that unwrap throws
253260 expect . fail ( "Should have thrown" ) ;
254261 } catch ( e ) {
255262 expect ( e ) . toStrictEqual (
@@ -260,7 +267,11 @@ describe("err input", () => {
260267
261268 test ( "expecting throws" , ( ) => {
262269 try {
263- RsResult . expect ( inputResult , "Custom error message" ) ;
270+ const result = RsResult . expect ( inputResult , "Custom error message" ) ;
271+
272+ expectTypeOf ( result ) . toMatchTypeOf < never > ( ) ;
273+
274+ // Ensure that expect throws
264275 expect . fail ( "Should have thrown" ) ;
265276 } catch ( e ) {
266277 expect ( e ) . toStrictEqual (
@@ -303,10 +314,14 @@ describe("non result input", () => {
303314
304315 test ( "unwrapping throws" , ( ) => {
305316 try {
306- RsResult . unwrap (
317+ const result = RsResult . unwrap (
307318 // @ts -expect-error Invalid typed value for the test
308319 123
309320 ) ;
321+
322+ expectTypeOf ( result ) . toMatchTypeOf < never > ( ) ;
323+
324+ // Ensure that unwrap throws
310325 expect . fail ( "Should have thrown" ) ;
311326 } catch ( e ) {
312327 expect ( e ) . toStrictEqual ( new Error ( `Unwrapping a non-result value: 123` ) ) ;
@@ -315,11 +330,15 @@ describe("non result input", () => {
315330
316331 test ( "expecting throws" , ( ) => {
317332 try {
318- RsResult . expect (
333+ const result = RsResult . expect (
319334 // @ts -expect-error Invalid typed value for the test
320335 123 ,
321336 "Custom error message"
322337 ) ;
338+
339+ expectTypeOf ( result ) . toMatchTypeOf < never > ( ) ;
340+
341+ // Ensure that unwrap throws
323342 expect . fail ( "Should have thrown" ) ;
324343 } catch ( e ) {
325344 expect ( e ) . toStrictEqual ( new Error ( `Unwrapping a non-result value: 123` ) ) ;
@@ -328,8 +347,14 @@ describe("non result input", () => {
328347
329348 test ( "unwrapping error throws" , ( ) => {
330349 try {
331- // @ts -expect-error Test
332- RsResult . unwrapErr ( 123 ) ;
350+ const result = RsResult . unwrapErr (
351+ // @ts -expect-error Test
352+ 123
353+ ) ;
354+
355+ expectTypeOf ( result ) . toMatchTypeOf < never > ( ) ;
356+
357+ // Ensure that unwrap throws
333358 expect . fail ( "Should have thrown" ) ;
334359 } catch ( e ) {
335360 expect ( e ) . toStrictEqual ( new Error ( `Unwrapping a non-result value: 123` ) ) ;
0 commit comments