fix(types): make PopupModal content accept JSXElement#3728
fix(types): make PopupModal content accept JSXElement#3728rxri merged 4 commits intospicetify:mainfrom
PopupModal content accept JSXElement#3728Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 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)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
globals.d.ts (1)
1293-1304: LGTM! Type widening correctly aligns with runtime behavior.The runtime implementation in
spicetifyWrapper.jsalready handles React elements viaSpicetify.React.isValidElement(content)and renders them usingReactDOM.render(). This type change properly reflects that capability in the type definitions.Consider updating the JSDoc comment to document React element support:
📝 Suggested documentation update
/** * You can specify a string for simple text display - * or a HTML element for interactive config/setting menu + * or a HTML element for interactive config/setting menu, + * or a React JSX element for React-based components */ content: string | Element | React.JSX.Element;,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@globals.d.ts` around lines 1293 - 1304, Update the JSDoc for the Content interface's content property to explicitly mention React element support: note that content can be a string, a DOM Element, or a React element (React.JSX.Element) and reference that the runtime (spicetifyWrapper.js) detects React elements via Spicetify.React.isValidElement(content) and renders them with ReactDOM.render; edit the comment above the content field in the Content interface to include this behavior and an optional note about interactive config/setting menus and rendering flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@globals.d.ts`:
- Around line 1293-1304: Update the JSDoc for the Content interface's content
property to explicitly mention React element support: note that content can be a
string, a DOM Element, or a React element (React.JSX.Element) and reference that
the runtime (spicetifyWrapper.js) detects React elements via
Spicetify.React.isValidElement(content) and renders them with ReactDOM.render;
edit the comment above the content field in the Content interface to include
this behavior and an optional note about interactive config/setting menus and
rendering flow.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7a71868d-8ba5-4c9c-9f1b-b1ea61c7d037
📒 Files selected for processing (1)
globals.d.ts
PopupModal content accept JSXElement
Summary by CodeRabbit