From 2571db9afc7c756dcbb757afedd8c0172d2f9c9b Mon Sep 17 00:00:00 2001
From: fiatjaf <fiatjaf@gmail.com>
Date: Tue, 19 Dec 2023 10:36:54 -0300
Subject: [PATCH] fix validateEvent() signature.

---
 event.test.ts | 2 --
 event.ts      | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/event.test.ts b/event.test.ts
index 2ebc808b..42352c69 100644
--- a/event.test.ts
+++ b/event.test.ts
@@ -122,9 +122,7 @@ describe('Event', () => {
 
     test('should return false for a non object event', () => {
       const nonObjectEvent = ''
-
       const isValid = validateEvent(nonObjectEvent)
-
       expect(isValid).toEqual(false)
     })
 
diff --git a/event.ts b/event.ts
index 28784628..f31248a5 100644
--- a/event.ts
+++ b/event.ts
@@ -49,7 +49,7 @@ export function getEventHash(event: UnsignedEvent): string {
 
 const isRecord = (obj: unknown): obj is Record<string, unknown> => obj instanceof Object
 
-export function validateEvent(event: UnsignedEvent): boolean {
+export function validateEvent<T>(event: T): event is T & UnsignedEvent {
   if (!isRecord(event)) return false
   if (typeof event.kind !== 'number') return false
   if (typeof event.content !== 'string') return false