11import fastify , { FastifyInstance , FastifyReply , FastifyRequest , preHandlerHookHandler } from 'fastify'
22import fastifyAuth from '..'
3- import { expectType } from 'tsd '
3+ import { expect } from 'tstyche '
44import { TypeBoxTypeProvider } from '@fastify/type-provider-typebox'
55import { JsonSchemaToTsProvider } from '@fastify/type-provider-json-schema-to-ts'
66
@@ -11,33 +11,33 @@ type Done = (error?: Error) => void
1111app . register ( fastifyAuth ) . after ( ( _err ) => {
1212 app . auth ( [
1313 ( request , reply , done ) => {
14- expectType < FastifyRequest > ( request )
15- expectType < FastifyReply > ( reply )
16- expectType < Done > ( done )
14+ expect ( request ) . type . toBe < FastifyRequest > ( )
15+ expect ( reply ) . type . toBe < FastifyReply > ( )
16+ expect ( done ) . type . toBe < Done > ( )
1717 } ,
1818 ] , { relation : 'or' } )
1919 app . auth ( [
2020 ( request , reply , done ) => {
21- expectType < FastifyRequest > ( request )
22- expectType < FastifyReply > ( reply )
23- expectType < Done > ( done )
21+ expect ( request ) . type . toBe < FastifyRequest > ( )
22+ expect ( reply ) . type . toBe < FastifyReply > ( )
23+ expect ( done ) . type . toBe < Done > ( )
2424 } ,
2525 ] , { run : 'all' } )
2626 app . auth ( [
2727 ( request , reply , done ) => {
28- expectType < FastifyRequest > ( request )
29- expectType < FastifyReply > ( reply )
30- expectType < Done > ( done )
28+ expect ( request ) . type . toBe < FastifyRequest > ( )
29+ expect ( reply ) . type . toBe < FastifyReply > ( )
30+ expect ( done ) . type . toBe < Done > ( )
3131 } ,
3232 ] )
3333 app . auth ( [
3434 function ( ) {
35- expectType < FastifyInstance > ( this )
35+ expect ( this ) . type . toBe < FastifyInstance > ( )
3636 } ,
3737 ] )
3838 const auth = app . auth ( [ ( ) => { } ] )
39- expectType < preHandlerHookHandler > ( auth )
40- app . get ( '/secret' , { preHandler : auth } , ( ) => { } )
39+ expect ( auth ) . type . toBe < preHandlerHookHandler > ( )
40+ app . get ( '/secret' , { preHandler : auth } , ( ) => { } )
4141 app . get ( '/private' , { preHandler : [ auth ] } , ( ) => { } )
4242} )
4343
@@ -102,7 +102,7 @@ async function usersController (fastify: FastifyInstance): Promise<void> {
102102 async ( ) => ( { success : true } )
103103 )
104104}
105- await usersController ( app )
105+ usersController ( app )
106106
107107async function usersControllerV2 ( fastify : FastifyInstance ) : Promise < void > {
108108 fastify . patch < {
@@ -116,4 +116,4 @@ async function usersControllerV2 (fastify: FastifyInstance): Promise<void> {
116116 async ( ) => ( { success : true } )
117117 )
118118}
119- await usersControllerV2 ( app )
119+ usersControllerV2 ( app )
0 commit comments