Skip to content

Conversation

Cinea4678
Copy link

@Cinea4678 Cinea4678 commented Aug 13, 2025

Description 描述

The type of _LivePusherProps.aspect from @uni-helper/uni-app-types is number currently, while the document of uni-app says it's string, see https://uniapp.dcloud.net.cn/component/live-pusher.html

Linked Issues 关联的 Issues

null

Additional context 额外上下文

null

Summary by CodeRabbit

  • New Features

    • Live Pusher aspect ratio now accepts string values (e.g., "3:2") for configuration.
  • Breaking Changes

    • The aspect property for Live Pusher has changed from number to string. Existing code passing numeric values must be updated to use string-based ratios.

Copy link

coderabbitai bot commented Aug 13, 2025

Walkthrough

Changed 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

Cohort / File(s) Summary
Type definition update
packages/uni-app-types/src/media-components/live-pusher.ts
_LivePusherProps.aspect type changed from number to string; exported LivePusherProps reflects the new string type.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~6 minutes

Poem

A bunny taps the keys—what luck!
Aspect flips from num to str—no muck.
Ratios now in colon flair,
“3:2,” I nibble, in the air.
Types align, I thump with glee,
Hop-approved API decree! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Aug 13, 2025

Deploy Preview for uni-typed ready!

Name Link
🔨 Latest commit 119db2f
🔍 Latest deploy log https://app.netlify.com/projects/uni-typed/deploys/689bfa20b737dd00081d7544
😎 Deploy Preview https://deploy-preview-42--uni-typed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

@coderabbitai coderabbitai bot left a 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 strings

If 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

📥 Commits

Reviewing files that changed from the base of the PR and between 74d3d7a and 119db2f.

📒 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 docs

Changing aspect to string aligns with the upstream documentation and the “默认为 3:2” note. Looks correct.


467-467: Note: This is a breaking type change for consumers

Consumers 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: Clarify aspect-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.
    /** Supported aspect ratios (may vary by platform) */
    type LivePusherAspect = "3:2" | "3:4" | "9:16";
    but note that other platforms (H5, App) may allow custom ratios.
  • No change to the code’s current aspect: string; definition is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant