ts-sinon
ts-sinon copied to clipboard
Allow stubInterface to support providing values
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected]
for the project I'm working on.
Related to this ticket https://github.com/ttarnowski/ts-sinon/issues/134, stubInterface
should allow providing values to the final object. It just seems to be a Typescript definition problem.
Here is the diff that solved my problem:
diff --git a/node_modules/ts-sinon/dist/index.d.ts b/node_modules/ts-sinon/dist/index.d.ts
index 6aa5ef7..a30df7f 100644
--- a/node_modules/ts-sinon/dist/index.d.ts
+++ b/node_modules/ts-sinon/dist/index.d.ts
@@ -9,5 +9,5 @@ export declare type ObjectMethodsMap<T> = {
};
export declare function stubObject<T extends object>(object: T, methods?: ObjectMethodsKeys<T> | ObjectMethodsMap<T>): StubbedInstance<T>;
export declare function stubConstructor<T extends new (...args: any[]) => any>(constructor: T, ...constructorArgs: ConstructorParameters<T> | undefined[]): StubbedInstance<InstanceType<T>>;
-export declare function stubInterface<T extends object>(methods?: ObjectMethodsMap<T>): StubbedInstance<T>;
+export declare function stubInterface<T extends object>(methods?: Partial<T>): StubbedInstance<T>;
export default sinon;
This issue body was partially generated by patch-package.
Same request as #134 I think?