fix: allow custom script keys in ScriptRegistry type#632
Conversation
Adds a string index signature to `ScriptRegistry` so custom scripts registered via `scripts:registry` hook are accepted in nuxt.config. Closes #581
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
The index signature on ScriptRegistry broke `keyof ScriptRegistry`
(returns `string | number` instead of `string`). Instead, add the
`Record<string & {}, any>` intersection to NuxtConfigScriptRegistry
which is used for nuxt.config validation only.
🔗 Linked issue
Resolves #581
❓ Type of change
📚 Description
Custom scripts registered via the
scripts:registryhook caused TypeScript errors innuxt.configbecauseScriptRegistryonly contained built-in keys. AddsRecord<string & {}, any>intersection toNuxtConfigScriptRegistry(notScriptRegistryitself, which would breakkeyof) so custom script keys are accepted while preserving autocomplete for built-in scripts.