Skip to content

Commit 4f86a2d

Browse files
committed
Type for full payload
1 parent cf46a7e commit 4f86a2d

File tree

1 file changed

+9
-3
lines changed
  • packages/destination-actions/src/destinations/loops/sendEvent

1 file changed

+9
-3
lines changed

packages/destination-actions/src/destinations/loops/sendEvent/index.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import type { ActionDefinition } from '@segment/actions-core'
22
import type { Settings } from '../generated-types'
33
import type { Payload } from './generated-types'
44

5+
type SendEventPayload = {
6+
email?: string
7+
eventName: string
8+
userId: string
9+
eventProperties?: Record<string, string | number | boolean>
10+
} & Record<string, string | number | boolean | null>
11+
512
const action: ActionDefinition<Settings, Payload> = {
613
title: 'Send Event',
714
description: 'Send an event for a contact in Loops',
@@ -61,9 +68,8 @@ const action: ActionDefinition<Settings, Payload> = {
6168
eventName: payload.eventName,
6269
userId: payload.userId,
6370
eventProperties: payload.eventProperties,
64-
...(typeof payload.contactProperties === 'object' &&
65-
(payload.contactProperties as { [k: string]: string | boolean | number | null }))
66-
}
71+
...(typeof payload.contactProperties === 'object' && payload.contactProperties)
72+
} as SendEventPayload
6773
})
6874
}
6975
}

0 commit comments

Comments
 (0)