Moved member welcome email constants file to TypeScript#27685
Moved member welcome email constants file to TypeScript#27685troyciesco merged 1 commit intomainfrom
Conversation
WalkthroughThis change enhances TypeScript type definitions in the member welcome emails constants module. The 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
🧹 Nitpick comments (1)
ghost/core/core/server/services/member-welcome-emails/constants.ts (1)
23-24: ⚡ Quick winNarrow
memberStatusto a derived union instead ofstring.The parameter currently accepts any
string, but runtime analysis showsmemberStatusis always one of the keys fromMEMBER_WELCOME_EMAIL_SLUGS('free'or'paid'). Deriving the type from this constant ensures compile-time safety and prevents invalid values from being passed.Proposed change
+type MemberWelcomeEmailStatus = keyof typeof MEMBER_WELCOME_EMAIL_SLUGS; + const MESSAGES = { @@ - memberWelcomeEmailInactive: (memberStatus: string) => `Member welcome email for "${memberStatus}" members is inactive` + memberWelcomeEmailInactive: (memberStatus: MemberWelcomeEmailStatus) => `Member welcome email for "${memberStatus}" members is inactive` } as const;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ghost/core/core/server/services/member-welcome-emails/constants.ts` around lines 23 - 24, The memberWelcomeEmailInactive function currently types memberStatus as string; narrow it to the actual keys of MEMBER_WELCOME_EMAIL_SLUGS by changing the parameter to a derived union (e.g. use keyof typeof MEMBER_WELCOME_EMAIL_SLUGS or define a MemberStatus = keyof typeof MEMBER_WELCOME_EMAIL_SLUGS type) so memberWelcomeEmailInactive(memberStatus: MemberStatus) => ... uses the constrained union instead of string; update any related exported types/signatures in constants.ts to use that derived type.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@ghost/core/core/server/services/member-welcome-emails/constants.ts`:
- Around line 23-24: The memberWelcomeEmailInactive function currently types
memberStatus as string; narrow it to the actual keys of
MEMBER_WELCOME_EMAIL_SLUGS by changing the parameter to a derived union (e.g.
use keyof typeof MEMBER_WELCOME_EMAIL_SLUGS or define a MemberStatus = keyof
typeof MEMBER_WELCOME_EMAIL_SLUGS type) so
memberWelcomeEmailInactive(memberStatus: MemberStatus) => ... uses the
constrained union instead of string; update any related exported
types/signatures in constants.ts to use that derived type.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c82bd1d2-5fd2-4c75-bdc5-6bba6d44c924
📒 Files selected for processing (1)
ghost/core/core/server/services/member-welcome-emails/constants.ts
no ref