Skip to content

Commit

Permalink
feat(types): export SetupServerApi class
Browse files Browse the repository at this point in the history
BREAKING CHANGE: export the SetupServerApi class instead of the interface
  • Loading branch information
gduliscouet-ubitransport committed Nov 25, 2022
1 parent a17f8d6 commit b9bd4e0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/node/SetupServerApi.ts
Expand Up @@ -16,6 +16,7 @@ import { mergeRight } from '../utils/internal/mergeRight'
import { MockedRequest } from '../utils/request/MockedRequest'
import { handleRequest } from '../utils/handleRequest'
import { devUtils } from '../utils/internal/devUtils'
import { SetupServer } from './glossary'

/**
* @see https://github.com/mswjs/msw/pull/1399
Expand All @@ -28,7 +29,10 @@ const DEFAULT_LISTEN_OPTIONS: RequiredDeep<SharedOptions> = {
onUnhandledRequest: 'warn',
}

export class SetupServerApi extends SetupApi<ServerLifecycleEventsMap> {
export class SetupServerApi
extends SetupApi<ServerLifecycleEventsMap>
implements SetupServer
{
protected readonly interceptor: BatchInterceptor<
Array<Interceptor<HttpRequestEventMap>>,
HttpRequestEventMap
Expand Down
2 changes: 1 addition & 1 deletion src/node/glossary.ts
Expand Up @@ -14,7 +14,7 @@ import { MockedRequest } from '../utils/request/MockedRequest'

export type ServerLifecycleEventsMap = LifeCycleEventsMap<IsomorphicResponse>

export interface SetupServerApi {
export interface SetupServer {
/**
* Starts requests interception based on the previously provided request handlers.
* @see {@link https://mswjs.io/docs/api/setup-server/listen `server.listen()`}
Expand Down
3 changes: 2 additions & 1 deletion src/node/index.ts
@@ -1,3 +1,4 @@
export { ServerLifecycleEventsMap } from './SetupServerApi'
export { setupServer } from './setupServer'
export type { SetupServerApi } from './glossary'
export type { SetupServer } from './glossary'
export { SetupServerApi } from './SetupServerApi'

0 comments on commit b9bd4e0

Please sign in to comment.