import { expectType } from 'tsd' import createHttpError from 'http-errors' import Fastify, { FastifyReply, FastifyRequest, preHandlerHookHandler } from 'fastify' import fastifyGuard from '.' const fastify = Fastify() fastify.register(fastifyGuard, { errorHandler: (result, req, reply) => { return reply.send('string') }, requestProperty: 'string', roleProperty: 'string', scopeProperty: 'string' }) ;(request: FastifyRequest, reply: FastifyReply) => { expectType( fastify.guard.hasRole(request, 'user') ) expectType( fastify.guard.hasScope(request, 'read') ) } expectType(fastify.guard.role('ceo')) expectType(fastify.guard.role('ceo', 'cto')) expectType(fastify.guard.role(['string'])) expectType(fastify.guard.scope('profile')) expectType(fastify.guard.scope('profile', 'blog')) expectType(fastify.guard.scope(['string']))