hsynlms / fastify-guard

A simple user role and scope check plugin to protect endpoints for Fastify
MIT License
49 stars 9 forks source link

Add missing options #5

Closed francisdaigle closed 3 years ago

francisdaigle commented 3 years ago

Add missing plugin options to TS declaration file.

hsynlms commented 3 years ago

Hi @francisdaigle

Thank you for the PR!

I just wonder that why you did some changes in index.test-d.ts?

francisdaigle commented 3 years ago

Hi @hsynlms

The missing options were added to the TSD test as well.

hsynlms commented 3 years ago

I mean lines 32 and 33 change nothing indeed. Also, role, scope, and request properties assignments (lines 17, 18, 19) are useless unless there is no user object within Fastify request.

francisdaigle commented 3 years ago

I mean lines 32 and 33 change nothing indeed.

Just being more explicit.

Also, role, scope, and user properties assignments (lines 17, 18, 19) are useless unless there is no user object within Fastify request.

Hmmm... to my knowledge, this is the standard way of going about things. I believe the point is to register the plugin and test that it compiles. Here's an example.

hsynlms commented 3 years ago

Thank you @francisdaigle