Closed hershmire closed 6 months ago
Thanks for reporting!
Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.
@mcollina here's a repo that reproduces this issue https://github.com/hershmire/fastify-auth-ts-bug.
@mcollina any update on this?
As you could imagine, I have been swamped. As things are, I'm not sure I'd have time to get to this bugs anytime soon. However, I'd love to see a PR that fixes this.
Hey @mcollina and @hershmire, I created this small PR #211 to fix this issue. I hope it's ok; otherwise, let me know, and I'll fix it.
Prerequisites
Fastify version
4.13.0
Plugin version
4.3.0
Node.js version
18.17.1
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
14.0
Description
I'm trying to use a generic on the
Params
property for a function that's sent to@fastify/auth
. However, when I do this, I get the following Typescript error:I'm unsure if this is a bug or I'm doing this incorrectly.
Steps to Reproduce
Below is a snippet of what I'm doing:
Something to note. If I just added
usersMutationAccessPolicy(fastify)
to theonRequest
directly, everything works as expected. Example:However, I'm looking to use
@fastify/auth
to compose more access policy functions.Expected Behavior
I don't receive any TS error when using
onRequest: fastify.auth([usersMutationAccessPolicy(fastify)]),
from above.