Skip to content

Commit 42ed459

Browse files
committed
add validator
1 parent 2f7815c commit 42ed459

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/core/src/validation/assertions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ export function assertUserIdentity(event: CoreSegmentEvent): void {
2323
export function assertEventExists(
2424
event?: CoreSegmentEvent | null
2525
): asserts event is CoreSegmentEvent {
26-
if (!event || typeof event !== 'object') {
26+
if (!exists(event)) {
2727
throw new ValidationError('Event', nilError)
2828
}
29+
if (typeof event !== 'object') {
30+
throw new ValidationError('Event', objError)
31+
}
2932
}
3033

3134
export function assertEventType(event: CoreSegmentEvent): void {

0 commit comments

Comments
 (0)