Fix platform type checking#5962
Open
sandboxcoder wants to merge 2 commits into
Open
Conversation
* twitch.js: revert putChannelInfo now that root cause has been addressed * platforms/index.ts: switch putChannelInfo from property shorthand to method shorthand, which uses bivariant parameter checking instead of strict contravariance
Contributor
There was a problem hiding this comment.
Pull request overview
This PR resolves a TypeScript platform-service type-checking warning by adjusting putChannelInfo typing: Twitch’s implementation is reverted to accept full Twitch start-stream settings again, and the shared IPlatformService contract is updated to use a method signature to avoid strict contravariant parameter checking across platform implementations.
Changes:
- Revert
TwitchService.putChannelInfoparameter type fromPartial<ITwitchStartStreamOptions>back toITwitchStartStreamOptions. - Change
IPlatformService.putChannelInfofrom a function-typed property to a method signature to use bivariant parameter checking.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| app/services/platforms/twitch.ts | Reverts putChannelInfo to require full Twitch start-stream settings. |
| app/services/platforms/index.ts | Updates IPlatformService.putChannelInfo to a method signature to address TS variance checking. |
Comments suppressed due to low confidence (1)
app/services/platforms/twitch.ts:519
ITwitchStartStreamOptionsrequirestagsandcontentClassificationLabels, but this method still treats them as optional (if (settings.tags)/ optional chaining). This makes the warning branch effectively dead and leaves the code out of sync with the new (non-Partial) signature.
async putChannelInfo(settings: ITwitchStartStreamOptions): Promise<void> {
if (settings.tags) {
this.twitchTagsService.actions.setTags(settings.tags);
} else {
console.warn('Trying to update Twitch channel info without tags, skipping tag update');
}
const hasPermission = await this.hasScope('channel:manage:broadcast');
const scopedTags = hasPermission ? settings.tags : undefined;
// Twitch seems to require you to add a label with disabled to remove it
const labels = this.twitchContentClassificationService.options.map(option => ({
id: option.value,
is_enabled: settings.contentClassificationLabels?.includes(option.value),
}));
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
BundleMonFiles added (4)
Total files change +12.59MB Final result: ✅ View report in BundleMon website ➡️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
putChannelInfonow that root cause has been addressedputChannelInfofrom property shorthand to method shorthand, which uses bivariant parameter checking instead of strict contravarianceFix this warning: