docs(react): clarify usePlayer typed vs untyped store access#1663
Open
Jerricho93 wants to merge 1 commit into
Open
docs(react): clarify usePlayer typed vs untyped store access#1663Jerricho93 wants to merge 1 commit into
Jerricho93 wants to merge 1 commit into
Conversation
Add a note callout on the use-player reference page contrasting the typed Player.usePlayer (from createPlayer) with the untyped standalone usePlayer, and enrich the standalone hook's JSDoc so the generated reference explains the UnknownStore return and selector-based typing. Refs videojs#1483
👷 Deploy request for vjs10-site pending review.Visit the deploys page to approve it
|
|
@Jerricho93 is attempting to deploy a commit to the Mux Team on Vercel. A member of the Team first needs to authorize it. |
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.
Closes #1483
Summary
The
use-playerreference page mentioned the typed-vs-untyped distinction only in a single easy-to-miss sentence, so users assumed the standaloneusePlayer()is supposed to returnunknown. This makes the distinction prominent on the page and corrects the standalone hook's generated reference.Changes
use-playerreference page:Player.usePlayer(fromcreatePlayer) is typed to the configured features and needs no selector, while the standaloneimport { usePlayer }returns an untypedUnknownStoreand needs a premade selector to recover typing.usePlayerJSDoc so the generated reference explains theUnknownStorereturn — and that inline selectors stayunknownwhile premade selectors (e.g.selectPlayback) carry their type.Testing
pnpm -F site api-docs— regenerates the util reference; confirmeduse-player.jsonnow includes the new JSDoc paragraphs.pnpm build:site— site builds and the page renders.Note
Low Risk
Documentation and JSDoc only; no runtime or type behavior changes.
Overview
Improves discoverability of typed vs. untyped
usePlayerbehavior so users don’t treat standaloneunknownreturns as a bug.The
use-playerreference adds a note callout and a short example:Player.usePlayerfromcreatePlayer()is feature-typed without a selector; standaloneimport { usePlayer } from '@videojs/react'yields anUnknownStore, with typing recoverable via premade selectors likeselectPlayback.JSDoc on the standalone
usePlayeroverloads now states the same — no feature knowledge,UnknownStore/UnknownState, inline selectors stayunknown, premade selectors carry their return type — so generated API reference matches the docs page.Reviewed by Cursor Bugbot for commit 8c447e2. Bugbot is set up for automated code reviews on this repo. Configure here.