mirror of
https://github.com/xtr-dev/payload-mailing.git
synced 2025-12-10 08:13:23 +00:00
Fix variables field type to support all JSON-compatible values
- Replace restrictive Record<string, any> with flexible JSONValue type for variables field
- Add JSONValue type alias that matches Payload's JSON field type specification
- Support string, number, boolean, objects, arrays, null, and undefined for variables
- Update both BaseEmailDocument and QueuedEmail interfaces consistently
- Update documentation to reflect JSONValue support
Fixes type constraint error where customer Email.variables field type
(string | number | boolean | {...} | unknown[] | null | undefined)
was not assignable to Record<string, any>.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,9 @@ Your Payload configuration determines which types are used. The plugin automatic
|
||||
The base interfaces provided by the plugin:
|
||||
|
||||
```typescript
|
||||
// JSON value type that matches Payload's JSON field type
|
||||
type JSONValue = string | number | boolean | { [k: string]: unknown } | unknown[] | null | undefined
|
||||
|
||||
interface BaseEmailDocument {
|
||||
id: string | number
|
||||
template?: any
|
||||
@@ -64,7 +67,7 @@ interface BaseEmailDocument {
|
||||
subject: string
|
||||
html: string
|
||||
text?: string | null
|
||||
variables?: Record<string, any> | null
|
||||
variables?: JSONValue // Supports any JSON-compatible value
|
||||
scheduledAt?: string | null
|
||||
sentAt?: string | null
|
||||
status?: 'pending' | 'processing' | 'sent' | 'failed' | null
|
||||
|
||||
Reference in New Issue
Block a user