feat: export ThemeName and make themes public in Uniwind class#460
feat: export ThemeName and make themes public in Uniwind class#460
Conversation
📝 WalkthroughWalkthroughThis PR refactors theme type management in the Uniwind package by renaming the internal Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment Tip You can customize the tone of the review comments and chat replies.Configure the |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/uniwind/src/components/web/rnw.ts`:
- Line 7: The type declaration uses the protected internal member `_themes` via
`typeof Uniwind['_themes']`, which violates TypeScript access rules; change the
type to use the public `themes` property instead (referencing the `themes`
getter on `Uniwind`) so the component's `themes` prop/type is derived from the
public API rather than the protected `_themes` field; update any occurrences
referencing `typeof Uniwind['_themes']` to the type of `Uniwind['themes']` or
the exported/public `themes` type provided by the `Uniwind` class.
In `@packages/uniwind/src/core/config/config.common.ts`:
- Around line 33-35: The themes getter currently exposes the internal _themes
array by reference and callers also store arrays directly into _themes
elsewhere, making internal theme state externally mutable; update the getter
(themes) to return a shallow copy of this._themes (not the original reference)
and wherever code assigns caller-provided arrays to this._themes (the assignment
site that writes to _themes around the other block), replace direct assignment
with a shallow copy of the incoming array so external mutations cannot alias
internal state; use array spread or slice to copy consistently for both read and
write operations.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 50e45997-5327-4768-ad5d-4f8a52066663
📒 Files selected for processing (3)
packages/uniwind/src/components/web/rnw.tspackages/uniwind/src/core/config/config.common.tspackages/uniwind/src/index.ts
|
🚀 This pull request is included in v1.6.0. See Release v1.6.0 for release notes. |
#459
Summary by CodeRabbit