Skip to content

fix(PollAnswer): only define _emoji property once #10811

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

Merged
merged 2 commits into from
Mar 27, 2025
Merged

Conversation

almeidx
Copy link
Member

@almeidx almeidx commented Mar 21, 2025

This causes an error TypeError: Cannot redefine property: _emoji.

Copy link

vercel bot commented Mar 21, 2025

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

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
discord-js ⬜️ Ignored (Inspect) Visit Preview Mar 27, 2025 6:01pm
discord-js-guide ⬜️ Ignored (Inspect) Visit Preview Mar 27, 2025 6:01pm

@Jiralite Jiralite requested a review from Copilot March 26, 2025 18:16
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the error "TypeError: Cannot redefine property: _emoji" by modifying how the _emoji property is defined and updated in PollAnswer.js. The key changes are:

  • The _emoji property is now defined only once with writable set to true.
  • The subsequent update of _emoji uses a direct assignment instead of re-defining the property.
Comments suppressed due to low confidence (1)

packages/discord.js/src/structures/PollAnswer.js:42

  • Ensure that making _emoji writable does not allow unintended external modifications elsewhere. If strict encapsulation is required, consider providing controlled access via a getter/setter.
Object.defineProperty(this, '_emoji', { value: null, writable: true });

@github-project-automation github-project-automation bot moved this from Todo to Review Approved in discord.js Mar 27, 2025
@kodiakhq kodiakhq bot merged commit 93f2ba0 into main Mar 27, 2025
25 checks passed
@kodiakhq kodiakhq bot deleted the fix/poll-answer-_emoji branch March 27, 2025 18:05
@github-project-automation github-project-automation bot moved this from Review Approved to Done in discord.js Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants