From e0848c8648bff67ea1ae697d826bd21bd68bd195 Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdxcode@users.noreply.github.com> Date: Thu, 31 May 2018 19:02:25 -0700 Subject: [PATCH] fix: simplify nock exports --- src/nock.ts | 8 +++----- src/types.ts | 5 +++++ tsconfig.json | 2 -- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/nock.ts b/src/nock.ts index 755b0bc..96e4147 100644 --- a/src/nock.ts +++ b/src/nock.ts @@ -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 @@ -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 diff --git a/src/types.ts b/src/types.ts index 666d999..b4e7a73 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,5 @@ export type PluginBuilder = (arg1?: A1, arg2?: A2, arg3?: A3, arg4?: A4) => Plugin +import Nock = require('nock') export interface Context { test: (typeof it | typeof it.skip) @@ -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 diff --git a/tsconfig.json b/tsconfig.json index a4b4749..c8a673e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,8 +3,6 @@ "declaration": true, "forceConsistentCasingInFileNames": true, "importHelpers": true, - "esModuleInterop": true, - "resolveJsonModule": true, "module": "commonjs", "outDir": "./lib", "rootDirs": [