44import { captureException } from '@sentry/core' ;
55import { logger } from '@sentry/utils' ;
66
7- import type { EventBuffer , RecordingEvent , WorkerAddEventResponse , WorkerRequest , WorkerResponse } from './types' ;
7+ import type { EventBuffer , RecordingEvent , WorkerAddEventResponse , WorkerRequest } from './types' ;
88import workerString from './worker/worker.js' ;
99
1010interface CreateEventBufferParams {
@@ -53,14 +53,14 @@ class EventBufferArray implements EventBuffer {
5353 this . _events = [ ] ;
5454 }
5555
56- public async addEvent ( event : RecordingEvent , isCheckout ?: boolean ) : Promise < boolean > {
56+ public async addEvent ( event : RecordingEvent , isCheckout ?: boolean ) : Promise < void > {
5757 if ( isCheckout ) {
5858 this . _events = [ event ] ;
59- return true ;
59+ return ;
6060 }
6161
6262 this . _events . push ( event ) ;
63- return true ;
63+ return ;
6464 }
6565
6666 public finish ( ) : Promise < string > {
@@ -134,7 +134,7 @@ export class EventBufferCompressionWorker implements EventBuffer {
134134 /**
135135 * Post message to worker and wait for response before resolving promise.
136136 */
137- private _postMessage ( { id, method, args } : WorkerRequest ) : Promise < WorkerResponse [ 'response' ] > {
137+ private _postMessage < T > ( { id, method, args } : WorkerRequest ) : Promise < T > {
138138 return new Promise ( ( resolve , reject ) => {
139139 // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
140140 const listener = ( { data } : MessageEvent ) => {
@@ -181,7 +181,7 @@ export class EventBufferCompressionWorker implements EventBuffer {
181181 * Send the event to the worker.
182182 */
183183 private async _sendEventToWorker ( event : RecordingEvent ) : Promise < WorkerAddEventResponse > {
184- const promise = this . _postMessage ( {
184+ const promise = this . _postMessage < void > ( {
185185 id : this . _getAndIncrementId ( ) ,
186186 method : 'addEvent' ,
187187 args : [ event ] ,
@@ -190,19 +190,19 @@ export class EventBufferCompressionWorker implements EventBuffer {
190190 // XXX: See note in `get length()`
191191 this . _eventBufferItemLength ++ ;
192192
193- return promise as Promise < WorkerAddEventResponse > ;
193+ return promise ;
194194 }
195195
196196 /**
197197 * Finish the request and return the compressed data from the worker.
198198 */
199199 private async _finishRequest ( id : number ) : Promise < Uint8Array > {
200- const promise = this . _postMessage ( { id, method : 'finish' , args : [ ] } ) ;
200+ const promise = this . _postMessage < Uint8Array > ( { id, method : 'finish' , args : [ ] } ) ;
201201
202202 // XXX: See note in `get length()`
203203 this . _eventBufferItemLength = 0 ;
204204
205- return promise as Promise < Uint8Array > ;
205+ return promise ;
206206 }
207207
208208 /** Get the current ID and increment it for the next call. */
0 commit comments