From 345ccdbe9e39f149e2f9684eb233b52e0cb306f2 Mon Sep 17 00:00:00 2001 From: Felix Becker Date: Thu, 28 Feb 2019 23:38:54 +0100 Subject: [PATCH] Fix wrong test https://github.com/DefinitelyTyped/DefinitelyTyped/pull/33223/files#r261413058 --- types/sinon/ts3.1/index.d.ts | 2 +- types/sinon/ts3.1/sinon-tests.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/sinon/ts3.1/index.d.ts b/types/sinon/ts3.1/index.d.ts index ccd9289ba3..80ec4ee483 100644 --- a/types/sinon/ts3.1/index.d.ts +++ b/types/sinon/ts3.1/index.d.ts @@ -1725,7 +1725,7 @@ declare namespace Sinon { createStubInstance( constructor: StubbableType, overrides?: { [K in keyof TType]?: - SinonStubbedMember | TType[K] extends (...args: any[]) => infer R ? R : TType[K] } + SinonStubbedMember | (TType[K] extends (...args: any[]) => infer R ? R : TType[K]) } ): SinonStubbedInstance; } diff --git a/types/sinon/ts3.1/sinon-tests.ts b/types/sinon/ts3.1/sinon-tests.ts index 24eb5b12b7..a2f8a393d8 100644 --- a/types/sinon/ts3.1/sinon-tests.ts +++ b/types/sinon/ts3.1/sinon-tests.ts @@ -89,9 +89,12 @@ function testSandbox() { const clsBar: number = stubInstance.bar; const privateFooBar: number = privateFooStubbedInstance.bar; sb.createStubInstance(cls, { - foo: (arg1: string, arg2: number) => 2, + foo: sinon.stub<[string, number], number>().returns(1), bar: 1 }); + sb.createStubInstance(cls, { + foo: 1, // used as return value + }); } function testFakeServer() {