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

CrossOriginResourcePolicyOptions: why not union type for policy? #379

Closed
gurdiga opened this issue Aug 22, 2022 · 1 comment
Closed

CrossOriginResourcePolicyOptions: why not union type for policy? #379

gurdiga opened this issue Aug 22, 2022 · 1 comment

Comments

@gurdiga
Copy link

gurdiga commented Aug 22, 2022

Hi! 👋🙂

The MDN docs for Cross-Origin-Resource-Policy say that it can have one of 3 values: same-site | same-origin | cross-origin — which looks a lot like a union type by the way… 😉

…and, I just wanted to ask if there is a reason for having the policy member in CrossOriginResourcePolicyOptions is of type string instead of a union type like this:

export interface CrossOriginResourcePolicyOptions {
  policy?: "same-site" | "same-origin" | "cross-origin";
}

Cheers!

@EvanHahn
Copy link
Member

This is done in the next version of Helmet, v6. The code looks almost exactly like you're suggesting:

export interface CrossOriginResourcePolicyOptions {
policy?: "same-origin" | "same-site" | "cross-origin";
}

See #370 for more.

I'm going to close this because I think this answers your question, but let me know if that's wrong and I can reopen.

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

No branches or pull requests

2 participants