Skip to content
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

fix(middleware/cors): export CORSOptions type #3860

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aryasaatvik
Copy link

@aryasaatvik aryasaatvik commented Jan 27, 2025

Exports the CORSOptions interface to allow external usage of the CORS middleware configuration type.

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

@yusukebe
Copy link
Member

Hi @aryasaatvik

Basically, we don't export option types of built-in middleware like CORSOptions, BasicAuthOptions, CompressionOptions, and others. So, honestly, I don't want to export the type as much as we can. If we allow exporting CORSOptions, we may have to export other option types. This may be fine, but "exporting something" means increasing maintenance costs. So, I can't decide if we merge this immediately.

@yusukebe
Copy link
Member

@aryasaatvik

If you want to get the type, you can use Parameters without importing CORSOptions.

type Options = Parameters<typeof cors>[0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants