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: LiveChatAuthorBadge where MetadataBadge was expected #179

Merged
merged 2 commits into from
Sep 9, 2022
Merged

fix: LiveChatAuthorBadge where MetadataBadge was expected #179

merged 2 commits into from
Sep 9, 2022

Conversation

Rydann
Copy link
Contributor

@Rydann Rydann commented Sep 9, 2022

Description

Fixes #178

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

@@ -38,13 +38,13 @@ class LiveChatPaidMessage extends YTNode {
id: data.authorExternalChannelId,
name: new Text(data.authorName),
thumbnails: Thumbnail.fromResponse(data.authorPhoto),
badges: Parser.parseArray<MetadataBadge>(data.authorBadges, MetadataBadge),
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's probably a good reason why this was typed MetadataBadge. Maybe opt for using Parser.parseArray<LiveChatAuthorBadge | MetadataBadge>(data.authorBadges, [MetadataBadge, LiveChatAuthorBadge]) instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't run into any case where this was necessary over the past 12 hours, but having a "failsafe" is never a bad idea, you got a point.
Let me add that to the other classes as well just in case.

@LuanRT LuanRT changed the title fix LiveChatAuthorBadge where MetadataBadge was expected fix: LiveChatAuthorBadge where MetadataBadge was expected Sep 9, 2022
@LuanRT LuanRT added the bug Something isn't working label Sep 9, 2022
@LuanRT LuanRT merged commit 9e618cc into LuanRT:main Sep 9, 2022
@Rydann Rydann deleted the live-chat-author-badge-fix branch September 9, 2022 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser small-diff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2.0.2 Error: Type mismatch, got LiveChatAuthorBadge but expected MetadataBadge
3 participants