@remotex-labs/xjet 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bash.js +1 -1
- package/dist/bash.js.map +1 -1
- package/dist/index.d.ts +24 -3
- package/dist/index.js.map +1 -1
- package/dist/shared.d.ts +59 -33
- package/dist/shared.js +1 -1
- package/dist/shared.js.map +4 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -178,7 +178,7 @@ declare function fnImplementation<ReturnType, Args extends Array<unknown>, Conte
|
|
|
178
178
|
*
|
|
179
179
|
* @since 1.2.2
|
|
180
180
|
*/
|
|
181
|
-
declare function mockImplementation<F extends abstract new (...args: any) => any>(method: F, implementation?: (...args: ConstructorParameters<F>) =>
|
|
181
|
+
declare function mockImplementation<F extends abstract new (...args: any) => any>(method: F, implementation?: (...args: ConstructorParameters<F>) => PartialResolvedType<InstanceType<F>>): MockState<(...args: ConstructorParameters<F>) => PartialResolvedType<InstanceType<F>>>;
|
|
182
182
|
/**
|
|
183
183
|
* Creates a mock implementation of the provided function.
|
|
184
184
|
*
|
|
@@ -213,7 +213,7 @@ declare function mockImplementation<F extends abstract new (...args: any) => any
|
|
|
213
213
|
*
|
|
214
214
|
* @since 1.2.2
|
|
215
215
|
*/
|
|
216
|
-
declare function mockImplementation<F extends FunctionType>(method: F, implementation?: (...args: Parameters<F>) =>
|
|
216
|
+
declare function mockImplementation<F extends FunctionType>(method: F, implementation?: (...args: Parameters<F>) => PartialResolvedType<ReturnType<F>>): MockState<(this: ThisParameterType<F>, ...args: Parameters<F>) => PartialResolvedType<ReturnType<F>>>;
|
|
217
217
|
/**
|
|
218
218
|
* Creates a mock for an element with an optional custom implementation.
|
|
219
219
|
*
|
|
@@ -292,6 +292,27 @@ interface MockableFunctionInterface<F extends FunctionType> extends MockState<F>
|
|
|
292
292
|
*/
|
|
293
293
|
(this: ThisParameterType<F>, ...args: Parameters<F>): ReturnType<F>;
|
|
294
294
|
}
|
|
295
|
+
/**
|
|
296
|
+
* Makes properties of a type or its resolved promise value optional.
|
|
297
|
+
*
|
|
298
|
+
* @template T - The type to transform
|
|
299
|
+
*
|
|
300
|
+
* @remarks
|
|
301
|
+
* If T is a Promise-like type, this utility unwraps it and makes the resolved value's
|
|
302
|
+
* properties optional. Otherwise, it directly makes T's properties optional.
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* ```ts
|
|
306
|
+
* // Makes properties of User optional
|
|
307
|
+
* type MaybeUser = PartialResolvedType<User>;
|
|
308
|
+
*
|
|
309
|
+
* // Makes properties of resolved User optional
|
|
310
|
+
* type MaybeAsyncUser = PartialResolvedType<Promise<User>>;
|
|
311
|
+
* ```
|
|
312
|
+
*
|
|
313
|
+
* @since 1.2.2
|
|
314
|
+
*/
|
|
315
|
+
type PartialResolvedType<T> = T extends PromiseLike<infer U> ? Promise<Partial<U>> : Partial<T>;
|
|
295
316
|
|
|
296
317
|
/**
|
|
297
318
|
* Import will remove at compile time
|
|
@@ -1560,7 +1581,7 @@ declare function spyOnProxyGet<T extends Record<string | symbol, unknown>, K ext
|
|
|
1560
1581
|
*
|
|
1561
1582
|
* @since 1.0.0
|
|
1562
1583
|
*/
|
|
1563
|
-
declare function spyOnImplementation<T extends object, K extends keyof T>(target: T, key: K): T[K] extends FunctionType ? MockState<(this: ThisParameterType<T[K]>, ...args: Parameters<T[K]>) => ReturnType<T[K]
|
|
1584
|
+
declare function spyOnImplementation<T extends object, K extends keyof T>(target: T, key: K): T[K] extends FunctionType ? MockState<(this: ThisParameterType<T[K]>, ...args: Parameters<T[K]>) => PartialResolvedType<ReturnType<T[K]>>> : MockState<() => T[K]>;
|
|
1564
1585
|
|
|
1565
1586
|
/**
|
|
1566
1587
|
* Interface representing the internal state of a mock proxy.
|