import Fastify from 'fastify' import fastifyAuth0Verify from '.' import { expectAssignable, expectType } from 'tsd' import { DecodePayloadType, FastifyJwtDecodeOptions } from '@fastify/jwt' import fastifyJWT from '@fastify/jwt' const fastify = Fastify() fastify.register(fastifyAuth0Verify, { domain: '', issuer: '', audience: '' }) fastify.register(fastifyAuth0Verify, { domain: '', issuer: //, audience: '' }) fastify.register(fastifyAuth0Verify, { domain: '', issuer: ['', //], audience: ['', ''] }) fastify.register(fastifyAuth0Verify, { domain: '', audience: ['', ''] }) fastify.register(fastifyJWT, { secret: '' }) fastify.register(fastifyAuth0Verify, { cookie: { cookieName: '', signed: true } }) fastify.register(fastifyAuth0Verify, { domain: '', issuer: '', audience: '', formatUser: () => ({ foo: 'bar' }), }) fastify.register(function (instance, _options, done) { instance.get('/verify', { handler: function (request, reply) { expectAssignable(request.jwtDecode); const options: FastifyJwtDecodeOptions = { decode:{ complete: true }, verify:{} } expectType>(request.jwtDecode(options)) expectType>(request.jwtDecode({decode:{ complete: true }, verify:{}})) expectType>(request.jwtDecode()) reply.send(request.user) }, preValidation: instance.authenticate }) done() })