@tapjs/intercept
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -22,3 +22,3 @@ import { TapPlugin, TestBase } from '@tapjs/core'; | ||
args: OverloadParams<F>; | ||
receiver: any; | ||
receiver: Receiver<F>; | ||
at?: CallSiteLike; | ||
@@ -125,2 +125,6 @@ stack?: string; | ||
/** | ||
* Infer the `this` target of a function | ||
*/ | ||
export type Receiver<F> = F extends (this: infer T, ...a: any[]) => any ? T : never; | ||
/** | ||
* The method returned by {@link @tapjs/intercept!Interceptor#capture}, | ||
@@ -210,3 +214,3 @@ * which returns the {@link @tapjs/intercept!CaptureResult} array when | ||
*/ | ||
capture<T extends {}, M extends Methods<T>>(obj: T, method: M, impl?: (...a: any[]) => any): CaptureResultsMethod<T, M>; | ||
capture<T extends {}, M extends Methods<T>>(obj: T, method: M, impl?: (this: T, ...a: any[]) => any): CaptureResultsMethod<T, M>; | ||
/** | ||
@@ -222,3 +226,3 @@ * Just wrap the function and return it. Does not have any | ||
*/ | ||
captureFn<F extends (this: any, ...a: any[]) => any>(original: F): ((...a: any[]) => any) & { | ||
captureFn<F extends (this: any, ...a: any[]) => any>(original: F): F & { | ||
calls: CaptureResult<F>[]; | ||
@@ -225,0 +229,0 @@ args: () => OverloadParams<F>[]; |
@@ -22,3 +22,3 @@ import { TapPlugin, TestBase } from '@tapjs/core'; | ||
args: OverloadParams<F>; | ||
receiver: any; | ||
receiver: Receiver<F>; | ||
at?: CallSiteLike; | ||
@@ -125,2 +125,6 @@ stack?: string; | ||
/** | ||
* Infer the `this` target of a function | ||
*/ | ||
export type Receiver<F> = F extends (this: infer T, ...a: any[]) => any ? T : never; | ||
/** | ||
* The method returned by {@link @tapjs/intercept!Interceptor#capture}, | ||
@@ -210,3 +214,3 @@ * which returns the {@link @tapjs/intercept!CaptureResult} array when | ||
*/ | ||
capture<T extends {}, M extends Methods<T>>(obj: T, method: M, impl?: (...a: any[]) => any): CaptureResultsMethod<T, M>; | ||
capture<T extends {}, M extends Methods<T>>(obj: T, method: M, impl?: (this: T, ...a: any[]) => any): CaptureResultsMethod<T, M>; | ||
/** | ||
@@ -222,3 +226,3 @@ * Just wrap the function and return it. Does not have any | ||
*/ | ||
captureFn<F extends (this: any, ...a: any[]) => any>(original: F): ((...a: any[]) => any) & { | ||
captureFn<F extends (this: any, ...a: any[]) => any>(original: F): F & { | ||
calls: CaptureResult<F>[]; | ||
@@ -225,0 +229,0 @@ args: () => OverloadParams<F>[]; |
{ | ||
"name": "@tapjs/intercept", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "a built-in tap extension for t.intercept() and t.capture()", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99919
977