Skip to content

Allow stubInterface to support providing values#191

Description

@richard-lopes-ifood

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch ts-sinon@2.0.1 for the project I'm working on.

Related to this ticket #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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions