-
-
Notifications
You must be signed in to change notification settings - Fork 9
fix: uni-app-types's _LivePusherProps.aspect
should be type string
#42
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughChanged LivePusherProps aspect property type from number to string in packages/uni-app-types/src/media-components/live-pusher.ts, updating the public API signature. No other properties or logic modified. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~6 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for uni-typed ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/uni-app-types/src/media-components/live-pusher.ts (1)
467-467
: Optional: narrow the type with a template-literal for ratio stringsIf the value is always a ratio like “3:2”, consider a template-literal type for better safety and DX.
Apply this diff here:
- aspect: string; + aspect: _LivePusherAspect;And add this alias near the other local type aliases:
type _LivePusherAspect = `${number}:${number}`;If the upstream allows non-ratio strings, skip this refinement.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/uni-app-types/src/media-components/live-pusher.ts
(1 hunks)
🔇 Additional comments (3)
packages/uni-app-types/src/media-components/live-pusher.ts (3)
467-467
: LGTM: aspect should be a string per uni-app docsChanging
aspect
tostring
aligns with the upstream documentation and the “默认为 3:2” note. Looks correct.
467-467
: Note: This is a breaking type change for consumersConsumers passing a number (e.g., 1.5) will now get TS errors and must pass strings (e.g., "3:2"). Ensure release notes clearly call this out (semver-major if you strictly follow semver for types).
Would you like me to draft a migration note snippet for the changelog?
467-467
: Clarifyaspect
-ratio typing and document platform constraints
- uni-app’s docs declare
aspect: string
with a default of"3:2"
but don’t enumerate all possible ratios.- In reality, each native platform enforces its own limited set (e.g. WeChat live-pusher only accepts
"3:4"
and"9:16"
).- Since there’s no single upstream enum, it’s safest to keep the prop typed as
string
and add a JSDoc remark listing the common supported values per platform.- If you later need stricter, cross-platform safety, you could introduce a union type—e.g.
but note that other platforms (H5, App) may allow custom ratios./** Supported aspect ratios (may vary by platform) */ type LivePusherAspect = "3:2" | "3:4" | "9:16";- No change to the code’s current
aspect: string;
definition is required.
Description 描述
The type of
_LivePusherProps.aspect
from@uni-helper/uni-app-types
isnumber
currently, while the document of uni-app says it'sstring
, see https://uniapp.dcloud.net.cn/component/live-pusher.htmlLinked Issues 关联的 Issues
null
Additional context 额外上下文
null
Summary by CodeRabbit
New Features
Breaking Changes