fix(site): work around #1111 in create-player/player-controller demos#1403
Merged
fix(site): work around #1111 in create-player/player-controller demos#1403
Conversation
Import `PlayerController` directly from `@videojs/html` in the two demos instead of destructuring it from `createPlayer()`. The destructured form returns `PlayerController.Constructor<Store>`, which eagerly defaults `Result` to `Store`, leaving no inference slot for the selector's return type. The standalone class keeps both type parameters generic at the `new` site, so inference works as expected. Temporary — revert once #1111 is fixed properly.
✅ Deploy Preview for vjs10-site ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📦 Bundle Size Report🎨 @videojs/html — no changesPresets (7)
Media (8)
Players (3)
Skins (17)
UI Components (25)
Sizes are marginal over the root entry point. ⚛️ @videojs/react — no changesPresets (7)
Media (7)
Skins (14)
UI Components (20)
Sizes are marginal over the root entry point. 🧩 @videojs/core — no changesEntries (9)
🏷️ @videojs/element — no changesEntries (2)
📦 @videojs/store — no changesEntries (3)
🔧 @videojs/utils — no changesEntries (10)
📦 @videojs/spf — no changesEntries (3)
ℹ️ How to interpretAll sizes are standalone totals (minified + brotli).
Run |
The demo files are rendered as source-code tabs on the public docs site, so comments explaining internal workarounds don't belong here. The rationale lives on #1111.
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.
Summary
PlayerControllerdirectly from@videojs/htmlin the two affected demos instead of destructuring it fromcreatePlayer(), unblocking theastro checkerrors called out in Bug: Premade Selectors Incompatible with createPlayer().PlayerController Types #1111.NOTEcomment in each file pointing back to Bug: Premade Selectors Incompatible with createPlayer().PlayerController Types #1111 so the workaround is easy to revert once the underlying type bug is fixed.Why
createPlayer()returnsPlayerController: PlayerController.Constructor<Store>. BecauseConstructor<Store, Result = Store>defaultsResulttoStore, the destructured class has both type parameters pre-bound toVideoPlayerStore— no inference slot remains for the selector's return type. The standalonePlayerControllerclass is still generic at thenewsite, soStoreis inferred fromcontextandResultfrom the selector.This is not a change in behavior — it's the same class and context, just routed around the eager
Resultdefault in theConstructortype alias. Both selector patterns (selectPlaybackand inline lambdas) typecheck afterward.The original contravariance story in #1111's description turned out to be a red herring; the actual mechanism is
Resultdefaulting. Details in the #1111 follow-up comment.Test plan
pnpm -F site astro checkno longer reports the twoSelector/VideoPlayerStoreerrors on:site/src/components/docs/demos/html-create-player/html/css/BasicUsage.ts:23site/src/components/docs/demos/player-controller/html/css/BasicUsage.ts:49super.update(),AbortSignal/applyElementProps) are unchanged and out of scope for this PR.https://claude.ai/code/session_017EhSmeZYDKJyRg3QC2JdM1
Note
Low Risk
Docs demo-only change that adjusts TypeScript imports/destructuring; no production logic or runtime behavior should change.
Overview
Updates the
html-create-playerandplayer-controllerdocs demos to importPlayerControllerdirectly from@videojs/htmland stop destructuring it fromcreatePlayer().This is a TypeScript typing workaround intended to unblock
astro checkfor the demos, without changing runtime behavior.Reviewed by Cursor Bugbot for commit 512a670. Bugbot is set up for automated code reviews on this repo. Configure here.