@@ -17,7 +17,7 @@ import {
1717 type JsonBodyType ,
1818 type PathParams ,
1919} from 'msw'
20- import type { SetupServerApi } from 'msw/node'
20+ import type { SetupServer } from 'msw/node'
2121import type { ZodObject , z } from 'zod/v4'
2222import { formatSseResponse , type SseMockEvent } from './MockttpHelper.ts'
2323
@@ -96,7 +96,7 @@ function joinURL(base: string, path: string): string {
9696}
9797
9898export type MockEndpointParams < PathParamsSchema extends z . Schema | undefined > = {
99- server : SetupServerApi
99+ server : SetupServer
100100 contract :
101101 | CommonRouteDefinition < any , PathParamsSchema , any , any , any , any , any , any >
102102 | PayloadRouteDefinition < any , any , PathParamsSchema , any , any , any , any , any , any >
@@ -213,7 +213,7 @@ export class MswHelper {
213213 any ,
214214 any
215215 > ,
216- server : SetupServerApi ,
216+ server : SetupServer ,
217217 params : PathParamsSchema extends z . Schema
218218 ? MswDualModeMockParams <
219219 InferSchemaInput < PathParamsSchema > ,
@@ -243,7 +243,7 @@ export class MswHelper {
243243 Events ,
244244 any
245245 > ,
246- server : SetupServerApi ,
246+ server : SetupServer ,
247247 params : PathParamsSchema extends z . Schema
248248 ? MswSseMockParams <
249249 InferSchemaInput < PathParamsSchema > ,
@@ -280,14 +280,14 @@ export class MswHelper {
280280 boolean ,
281281 any
282282 > ,
283- server : SetupServerApi ,
283+ server : SetupServer ,
284284 params : PathParamsSchema extends undefined
285285 ? MockParamsNoPath < InferSchemaInput < ResponseBodySchema > >
286286 : MockParams < InferSchemaInput < PathParamsSchema > , InferSchemaInput < ResponseBodySchema > > ,
287287 ) : void
288288
289289 // Implementation
290- mockValidResponse ( contract : any , server : SetupServerApi , params : any ) : void {
290+ mockValidResponse ( contract : any , server : SetupServer , params : any ) : void {
291291 if ( 'isDualMode' in contract && contract . isDualMode ) {
292292 const { resolvedPath, method } = this . resolveStreamingPath ( contract , params . pathParams )
293293 const sseBody = formatSseResponse ( params . events )
@@ -351,7 +351,7 @@ export class MswHelper {
351351 any ,
352352 any
353353 > ,
354- server : SetupServerApi ,
354+ server : SetupServer ,
355355 params : MswDualModeMockParamsNoPath <
356356 InferSchemaInput < RequestQuerySchema > ,
357357 InferSchemaInput < ResponseBodySchema > ,
@@ -373,7 +373,7 @@ export class MswHelper {
373373 Events ,
374374 any
375375 > ,
376- server : SetupServerApi ,
376+ server : SetupServer ,
377377 params : MswSseMockParamsNoPath < InferSchemaInput < RequestQuerySchema > , Events > ,
378378 ) : void
379379
@@ -401,12 +401,12 @@ export class MswHelper {
401401 boolean ,
402402 any
403403 > ,
404- server : SetupServerApi ,
404+ server : SetupServer ,
405405 params : MockParamsNoPath < InferSchemaInput < ResponseBodySchema > > ,
406406 ) : void
407407
408408 // Implementation
409- mockValidResponseWithAnyPath ( contract : any , server : SetupServerApi , params : any ) : void {
409+ mockValidResponseWithAnyPath ( contract : any , server : SetupServer , params : any ) : void {
410410 const pathParams = contract . requestPathParamsSchema
411411 ? Object . keys ( ( contract . requestPathParamsSchema as ZodObject < any > ) . shape ) . reduce (
412412 ( acc , value ) => {
@@ -438,7 +438,7 @@ export class MswHelper {
438438 any ,
439439 any
440440 > ,
441- server : SetupServerApi ,
441+ server : SetupServer ,
442442 params : ( PathParamsSchema extends z . Schema
443443 ? MockWithImplementationParams < any , any , any >
444444 : MockWithImplementationParamsNoPath < any , any , any > ) & {
@@ -476,14 +476,14 @@ export class MswHelper {
476476 boolean ,
477477 any
478478 > ,
479- server : SetupServerApi ,
479+ server : SetupServer ,
480480 params : PathParamsSchema extends undefined
481481 ? MockWithImplementationParamsNoPath < any , any , any >
482482 : MockWithImplementationParams < any , any , any > ,
483483 ) : void
484484
485485 // Implementation
486- mockValidResponseWithImplementation ( contract : any , server : SetupServerApi , params : any ) : void {
486+ mockValidResponseWithImplementation ( contract : any , server : SetupServer , params : any ) : void {
487487 if ( 'isDualMode' in contract && contract . isDualMode ) {
488488 const { resolvedPath, method } = this . resolveStreamingPath ( contract , params . pathParams )
489489 const sseBody = formatSseResponse ( params . events )
@@ -539,7 +539,7 @@ export class MswHelper {
539539 any ,
540540 any
541541 > ,
542- server : SetupServerApi ,
542+ server : SetupServer ,
543543 params : PathParamsSchema extends z . Schema
544544 ? MswDualModeMockParams <
545545 InferSchemaInput < PathParamsSchema > ,
@@ -555,14 +555,14 @@ export class MswHelper {
555555 contract :
556556 | CommonRouteDefinition < any , PathParamsSchema , any , any , any , any , any , any >
557557 | PayloadRouteDefinition < any , any , PathParamsSchema , any , any , any , any , any , any > ,
558- server : SetupServerApi ,
558+ server : SetupServer ,
559559 params : PathParamsSchema extends undefined
560560 ? MockParamsNoPath < InferSchemaInput < any > >
561561 : MockParams < InferSchemaInput < PathParamsSchema > , InferSchemaInput < any > > ,
562562 ) : void
563563
564564 // Implementation
565- mockAnyResponse ( contract : any , server : SetupServerApi , params : any ) : void {
565+ mockAnyResponse ( contract : any , server : SetupServer , params : any ) : void {
566566 if ( 'isDualMode' in contract && contract . isDualMode ) {
567567 const { resolvedPath, method } = this . resolveStreamingPath ( contract , params . pathParams )
568568 const sseBody = formatSseResponse ( params . events )
@@ -612,7 +612,7 @@ export class MswHelper {
612612 any ,
613613 any
614614 > ,
615- server : SetupServerApi ,
615+ server : SetupServer ,
616616 params : ( PathParamsSchema extends z . Schema
617617 ? { pathParams : InferSchemaInput < PathParamsSchema > }
618618 : { pathParams ?: undefined } ) & {
@@ -638,7 +638,7 @@ export class MswHelper {
638638 Events ,
639639 any
640640 > ,
641- server : SetupServerApi ,
641+ server : SetupServer ,
642642 params ?: ( PathParamsSchema extends z . Schema
643643 ? { pathParams : InferSchemaInput < PathParamsSchema > }
644644 : { pathParams ?: undefined } ) &
@@ -649,7 +649,7 @@ export class MswHelper {
649649 ) : SseEventController < Events >
650650
651651 // Implementation
652- mockSseStream ( contract : any , server : SetupServerApi , params ?: any ) : SseEventController < any > {
652+ mockSseStream ( contract : any , server : SetupServer , params ?: any ) : SseEventController < any > {
653653 const pathParams = params ?. pathParams
654654 const { resolvedPath, method } = this . resolveStreamingPath ( contract , pathParams )
655655 const encoder = new TextEncoder ( )
0 commit comments