Skip to content

fix(types): add missing types for Player and ReactJSX#3732

Open
sanoojes wants to merge 4 commits intospicetify:mainfrom
sanoojes:main
Open

fix(types): add missing types for Player and ReactJSX#3732
sanoojes wants to merge 4 commits intospicetify:mainfrom
sanoojes:main

Conversation

@sanoojes
Copy link
Contributor

@sanoojes sanoojes commented Mar 11, 2026

Summary by CodeRabbit

  • New Features
    • Smart shuffle support added to player state.
    • Expanded track metadata with canvas/artist artwork details.
    • Added comprehensive video association metadata for tracks.
    • Exposed a player origin API and a global JSX runtime instance for component transformation.

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fde94b41-0bd9-4b71-a510-9992c670422e

📥 Commits

Reviewing files that changed from the base of the PR and between 3b9edf9 and 62052c7.

📒 Files selected for processing (1)
  • globals.d.ts

📝 Walkthrough

Walkthrough

This PR augments public TypeScript declarations: adds smartShuffle to Spicetify.PlayerState, extends Spicetify.TrackMetadata with canvas and video-association string fields plus an index signature, exposes Spicetify.Player.origin, and exports a ReactJSX runtime instance.

Changes

Cohort / File(s) Summary
TypeScript Type Augmentation
globals.d.ts
Added smartShuffle: boolean to Spicetify.PlayerState; added canvas-related fields (canvas.artist.*, canvas.*) and multiple video_association* fields to Spicetify.TrackMetadata; added [key: string]: string index signature to TrackMetadata; added const origin: any to Spicetify.Player; exported const ReactJSX: any globally.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 I hopped through types with gleeful cheer,

Canvas and videos now appear,
SmartShuffle twitches, origin peeks,
JSX springs where runtime speaks,
A tiny hop — new fields are here.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding missing type definitions for Player namespace properties and ReactJSX export to the type declaration file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • 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

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

🧹 Nitpick comments (1)
globals.d.ts (1)

270-281: Consider making the index signature return type account for absent properties.

The index signature [key: string]: string is a good addition for extensibility. However, it implies that any arbitrary property access will return string, when in reality properties may be absent at runtime. Compare with the existing Metadata type on line 167 which uses Partial<Record<string, string>>.

A more precise signature would be:

-		[key: string]: string;
+		[key: string]: string | undefined;

This would make TypeScript enforce null checks on dynamic property access while still allowing the explicitly declared fields to be treated as present.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@globals.d.ts` around lines 270 - 281, The index signature currently declared
as [key: string]: string incorrectly forces all dynamic property access to be
string even when properties may be absent; update the signature in the same
interface that contains associated_video_id, video_association,
video_association_image, etc. to allow undefined (for example change [key:
string]: string to [key: string]: string | undefined or replace with
Partial<Record<string, string>> to match the existing Metadata pattern) so
consumers must handle missing keys while keeping the explicit fields typed as
strings.
🤖 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 270-281: The index signature currently declared as [key: string]:
string incorrectly forces all dynamic property access to be string even when
properties may be absent; update the signature in the same interface that
contains associated_video_id, video_association, video_association_image, etc.
to allow undefined (for example change [key: string]: string to [key: string]:
string | undefined or replace with Partial<Record<string, string>> to match the
existing Metadata pattern) so consumers must handle missing keys while keeping
the explicit fields typed as strings.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3954b44e-d8a8-40d8-9f57-acd436afee90

📥 Commits

Reviewing files that changed from the base of the PR and between 40008f8 and 3b9edf9.

📒 Files selected for processing (1)
  • globals.d.ts

@sanoojes sanoojes changed the title fix(types): add missing types for Player fix(types): add missing types for Player and ReactJSX Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant