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(rest/oauth2): correct string literal types containing bot scope #1101

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Renegade334
Copy link
Contributor

Please describe the changes this PR makes and why it should be merged:

Minor fixes for the scope property type unions within the bot-specific query interfaces in rest/oauth2:

  • Wrap the bare case (OAuth2Scopes.Bot) in a template literal, so that passing scope: "bot" is valid and doesn't raise a compilation error.
  • No longer consider %20 a valid space. For the parameters to exist in object form, they are by definition not yet URL-encoded, and passing a property like scope: "bot%20identify" to URLSearchParams would just re-encode the percent sign, resulting in an invalid OAuth2 query.
  • Fix the order of the "sandwich" case ("activities.read bot identify"). Previously, this string would raise a compilation error, due to the misplaced final space in the template literal type.

Copy link

vercel bot commented Sep 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
discord-api-types ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 18, 2024 10:11pm

vladfrangu
vladfrangu previously approved these changes Sep 18, 2024
Copy link
Member

@vladfrangu vladfrangu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add in a tsd test too? Similar to the one did for routes

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

Successfully merging this pull request may close these issues.

2 participants