-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript Support: Origin is undefined #154
Comments
Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
Unfortunately, this issue goes beyond my understanding, otherwise, I'd love to help out |
Merged
This still happens with Fastify 4 and Fastify CORS 8.1.0 |
Please open a new detailed issue adding a Minimal, Reproducible Example. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
Fastify version
3.0.0
Plugin version
3.0.0
Node.js version
v14.15.4
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
11.5.2
Description
Following the async example in a typescript environment with fastify plugin results in origin is undefined
Steps to Reproduce
Trying to set up CORS for fastify vai the fastify-plugin in a fairly strict typescript environment. The docs showing the async configuration https://github.com/fastify/fastify-cors#configuring-cors-asynchronously
The error I get is
How do I define origin?
If I try the non-async example from the docs origin is still undefined
Expected Behavior
I expect typescript to not complain about origin being undefined
Demo code can be found here https://github.com/bkawk/fastify-swagger/blob/cors/src/plugins/cors.ts
The text was updated successfully, but these errors were encountered: