@@ -186,26 +186,25 @@ function extractDefaultEvent(node, checker, sourceFile) {
186186function processEventData ( eventData , source , filePath , line , functionName , checker , sourceFile , customConfig ) {
187187 const { eventName, propertiesNode } = eventData ;
188188
189- if ( ! eventName || ! propertiesNode ) {
189+ // Require an event name – properties are optional.
190+ if ( ! eventName ) {
190191 return null ;
191192 }
192193
193- let properties = null ;
194+ let properties = { } ;
194195
195- // Check if properties is an object literal
196- if ( ts . isObjectLiteralExpression ( propertiesNode ) ) {
197- properties = extractProperties ( checker , propertiesNode ) ;
198- }
199- // Check if properties is an identifier (variable reference)
200- else if ( ts . isIdentifier ( propertiesNode ) ) {
201- const resolvedNode = resolveIdentifierToInitializer ( checker , propertiesNode , sourceFile ) ;
202- if ( resolvedNode && ts . isObjectLiteralExpression ( resolvedNode ) ) {
203- properties = extractProperties ( checker , resolvedNode ) ;
196+ if ( propertiesNode ) {
197+ // Check if properties is an object literal
198+ if ( ts . isObjectLiteralExpression ( propertiesNode ) ) {
199+ properties = extractProperties ( checker , propertiesNode ) ;
200+ }
201+ // Check if properties is an identifier (variable reference)
202+ else if ( ts . isIdentifier ( propertiesNode ) ) {
203+ const resolvedNode = resolveIdentifierToInitializer ( checker , propertiesNode , sourceFile ) ;
204+ if ( resolvedNode && ts . isObjectLiteralExpression ( resolvedNode ) ) {
205+ properties = extractProperties ( checker , resolvedNode ) ;
206+ }
204207 }
205- }
206-
207- if ( ! properties ) {
208- return null ;
209208 }
210209
211210 // Special handling for Snowplow: remove 'action' from properties
0 commit comments