diff --git a/src/globals.d.ts b/src/globals.d.ts index f12ea446..fee33e14 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -1,5 +1,5 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars -import { IsMockProp, SpyOnProp } from "jest-mock-props"; +import { IsMockProp, SpyOnProp } from "./types"; declare global { namespace jest { diff --git a/src/index.ts b/src/index.ts index 23b658d6..4f476704 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { IsMockProp, Obj, Spyable, SpyOnProp, ValueOf } from "jest-mock-props"; +import { IsMockProp, Obj, Spyable, SpyOnProp, ValueOf } from "./types"; export const messages = { error: { @@ -36,7 +36,7 @@ const getAllSpies = () => { return spies; }; -class MockProp implements MockProp { +export class MockProp implements MockProp { private initialPropDescriptor: PropertyDescriptor; private initialPropValue: T; private object: Obj; diff --git a/src/types.d.ts b/src/types.d.ts index 2f13fcaa..80bf6960 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -1,23 +1,21 @@ -declare module "jest-mock-props" { - export type Obj = Record; +export type Obj = Record; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - export type Spyable = Obj; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type Spyable = Obj; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - export type ValueOf = O extends Record ? T : any; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type ValueOf = O extends Record ? T : any; - export interface MockProp { - mockClear(): void; - mockReset(): void; - mockRestore(): void; - mockValue(v: T): MockProp; - mockValueOnce(v: T): MockProp; - } - - export type IsMockProp = (object: Obj, propName: string) => boolean; - export type SpyOnProp = ( - object: Spyable, - propName: string, - ) => MockProp>; +export interface MockProp { + mockClear(): void; + mockReset(): void; + mockRestore(): void; + mockValue(v: T): MockProp; + mockValueOnce(v: T): MockProp; } + +export type IsMockProp = (object: Obj, propName: string) => boolean; +export type SpyOnProp = ( + object: Spyable, + propName: string, +) => MockProp>; diff --git a/tests/index.test.ts b/tests/index.test.ts index 48b919ef..620e25f4 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,4 +1,4 @@ -import { Obj } from "jest-mock-props"; +import { Obj } from "src/types"; import * as mockProps from "src/index"; // eslint-disable-next-line @typescript-eslint/no-explicit-any