Skip to content

Commit

Permalink
fix(setupWorker): resolve the TS4094 error (#1477)
Browse files Browse the repository at this point in the history
fix(types): type setupWorker return with interface
  • Loading branch information
gduliscouet-ubitransport authored Nov 27, 2022
1 parent 2553156 commit c268796
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/setupWorker/setupWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ import { createFallbackStop } from './stop/createFallbackStop'
import { devUtils } from '../utils/internal/devUtils'
import { SetupApi } from '../SetupApi'
import { mergeRight } from '../utils/internal/mergeRight'
import { SetupWorkerApi as SetupWorker } from './glossary'

interface Listener {
target: EventTarget
eventType: string
callback: EventListener
}

export class SetupWorkerApi extends SetupApi<WorkerLifecycleEventsMap> {
class SetupWorkerApi
extends SetupApi<WorkerLifecycleEventsMap>
implements SetupWorker
{
private context: SetupWorkerInternalContext
private startHandler: StartHandler = null as any
private stopHandler: StopHandler = null as any
Expand Down Expand Up @@ -221,8 +225,6 @@ export class SetupWorkerApi extends SetupApi<WorkerLifecycleEventsMap> {
* @param {RequestHandler[]} handlers List of request handlers.
* @see {@link https://mswjs.io/docs/api/setup-worker `setupWorker`}
*/
export function setupWorker(
...handlers: Array<RequestHandler>
): SetupWorkerApi {
export function setupWorker(...handlers: Array<RequestHandler>): SetupWorker {
return new SetupWorkerApi(...handlers)
}

0 comments on commit c268796

Please sign in to comment.