Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
fix: simplify nock exports
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jun 1, 2018
1 parent dc6588a commit e0848c8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/nock.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Nock = require('nock')

export function nock(host?: string, options?: Callback | Options, cb?: Callback) {
import {NockCallback, NockOptions} from './types'

export function nock(host?: string, options?: NockCallback | NockOptions, cb?: NockCallback) {
if (host === undefined) throw new Error('host is undefined')
if (typeof options === 'function') {
cb = options
Expand Down Expand Up @@ -32,7 +34,3 @@ export function nock(host?: string, options?: Callback | Options, cb?: Callback)
},
}
}

export interface Scope extends Nock.Scope {}
export interface Options extends Nock.Options {}
export type Callback = (nock: Scope) => any
5 changes: 5 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export type PluginBuilder<I, A1 = undefined, A2 = undefined, A3 = undefined, A4 = undefined> = (arg1?: A1, arg2?: A2, arg3?: A3, arg4?: A4) => Plugin<I>
import Nock = require('nock')

export interface Context {
test: (typeof it | typeof it.skip)
Expand Down Expand Up @@ -54,3 +55,7 @@ export interface EnvOptions {
}

export type MochaDone = (error?: any) => any

export interface NockScope extends Nock.Scope {}
export interface NockOptions extends Nock.Options {}
export type NockCallback = (nock: NockScope) => any
2 changes: 0 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"declaration": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"module": "commonjs",
"outDir": "./lib",
"rootDirs": [
Expand Down

0 comments on commit e0848c8

Please sign in to comment.