refactor: improve AccentColorId type constraints#1972
refactor: improve AccentColorId type constraints#1972maxchang3 wants to merge 1 commit intonpmx-dev:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
📝 WalkthroughWalkthroughThe pull request centralises accent colour type definitions and improves type safety across the codebase. A new Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/utils/prehydrate.ts (1)
13-21:⚠️ Potential issue | 🔴 CriticalAdd import for
ACCENT_COLOR_IDSor use a module type query to avoid build-time type error.
ACCENT_COLOR_IDSis not declared or imported in this file, and the Nuxt auto-import configuration does not extend to#shared/utils/constants. Usingsatisfies typeof ACCENT_COLOR_IDSwill cause a TypeScript build failure. Either add an explicit import statement or use a module type query to keep the type check self-contained within the function.Suggested change
- ] satisfies typeof ACCENT_COLOR_IDS) + ] satisfies typeof import('#shared/utils/constants').ACCENT_COLOR_IDS)
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 72907f03-528e-485a-bc58-660e6c50e9f3
📒 Files selected for processing (3)
app/composables/useSettings.tsapp/utils/prehydrate.tsshared/utils/constants.ts
🔗 Linked issue
/
🧭 Context
Currently, there are two typing issues regarding
ACCENT_COLORSwithin the project:onPrehydraterequires runtime-hardcoded values, which made localaccentColorIdsinprehydrate.tseasy to drift from the shared accent color constant (See fix: add neutral to accentColorIds in prehydration #1797).ACCENT_COLORSwas previously defined as a plain const, which did not enforce complete key alignment betweenlightanddark.📚 Description
This PR only improves type safety and consistency without affecting runtime behavior:
ACCENT_COLOR_IDSconst and export the inferred union typeAccentColorId.ACCENT_COLORS.accentColorIdsinprehydrate.tsto ensure it remains in sync withACCENT_COLOR_IDS.