diff --git a/types/karma-chai-sinon/index.d.ts b/types/karma-chai-sinon/index.d.ts index 1ce2672b23..76ee313a40 100644 --- a/types/karma-chai-sinon/index.d.ts +++ b/types/karma-chai-sinon/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/tubalmartin/karma-chai-sinon // Definitions by: Václav Ostrožlík // Definitions: https://github.com/borisyankov/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.3 /// import Sinon = require("sinon"); diff --git a/types/mochaccino/index.d.ts b/types/mochaccino/index.d.ts index 3f0a2e9688..b230218ee9 100644 --- a/types/mochaccino/index.d.ts +++ b/types/mochaccino/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/pawelgalazka/mochaccino#readme // Definitions by: Thomas-P // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.3 import * as Sinon from "sinon"; export interface Expect { not: Expect; diff --git a/types/should-sinon/index.d.ts b/types/should-sinon/index.d.ts index 467d217aa9..25233c1c61 100644 --- a/types/should-sinon/index.d.ts +++ b/types/should-sinon/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/shouldjs/sinon // Definitions by: AryloYeung // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.3 import * as s from "sinon"; import should = require("should"); diff --git a/types/sinon-as-promised/index.d.ts b/types/sinon-as-promised/index.d.ts index 49e9b29bd3..097e13a1a0 100644 --- a/types/sinon-as-promised/index.d.ts +++ b/types/sinon-as-promised/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/bendrucker/sinon-as-promised // Definitions by: igrayson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.3 import * as s from "sinon"; diff --git a/types/sinon-chai/index.d.ts b/types/sinon-chai/index.d.ts index cff6d0b3a2..8c6d7eb2d0 100644 --- a/types/sinon-chai/index.d.ts +++ b/types/sinon-chai/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/domenic/sinon-chai // Definitions by: Kazi Manzur Rashid , Jed Mao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.3 /// /// diff --git a/types/sinon-chrome/index.d.ts b/types/sinon-chrome/index.d.ts index 9776b0bb30..263135e060 100644 --- a/types/sinon-chrome/index.d.ts +++ b/types/sinon-chrome/index.d.ts @@ -4,7 +4,7 @@ // CRIMX // kobanyan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.4 /// /// diff --git a/types/sinon-express-mock/index.d.ts b/types/sinon-express-mock/index.d.ts index f3974fc005..10c8ef824d 100644 --- a/types/sinon-express-mock/index.d.ts +++ b/types/sinon-express-mock/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Jared Chapiewsky // Tomek Łaziuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.3 import { SinonStub, diff --git a/types/sinon-mongoose/index.d.ts b/types/sinon-mongoose/index.d.ts index 86109b4917..2d9099a060 100644 --- a/types/sinon-mongoose/index.d.ts +++ b/types/sinon-mongoose/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/underscopeio/sinon-mongoose // Definitions by: stevehipwell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.3 import * as s from "sinon"; diff --git a/types/sinon-stub-promise/index.d.ts b/types/sinon-stub-promise/index.d.ts index d817113cf7..6de3b17b2a 100644 --- a/types/sinon-stub-promise/index.d.ts +++ b/types/sinon-stub-promise/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Thiago Temple // Tim Stackhouse // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.3 /// diff --git a/types/sinon-test/index.d.ts b/types/sinon-test/index.d.ts index 902064a7cb..4cda8702a6 100644 --- a/types/sinon-test/index.d.ts +++ b/types/sinon-test/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/sinonjs/sinon-test // Definitions by: Francis Saul // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.3 import * as Sinon from 'sinon'; diff --git a/types/sinon/index.d.ts b/types/sinon/index.d.ts index 0bc7d112fc..2395ee2ed2 100644 --- a/types/sinon/index.d.ts +++ b/types/sinon/index.d.ts @@ -5,9 +5,8 @@ // Lukas Spieß // Nico Jansen // James Garbutt -// Josh Goldberg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.3 // sinon uses DOM dependencies which are absent in browser-less environment like node.js // to avoid compiler errors this monkey patch is used @@ -567,20 +566,15 @@ declare namespace Sinon { } /** - * An instance of a stubbed object type with functions replaced by stubs. + * An instance of a stubbed object type with members replaced by stubs. * * @template TType Object type being stubbed. */ type SinonStubbedInstance = { // TODO: this should really only replace functions on TType with SinonStubs, not all properties // Likely infeasible without mapped conditional types, per https://github.com/Microsoft/TypeScript/issues/12424 - [P in keyof TType]: SinonStubbedMember; + [P in keyof TType]: SinonStub; }; - - /** - * Replaces a type with a Sinon stub if it's a function. - */ - type SinonStubbedMember = T extends Function ? SinonStub : T; } declare const Sinon: Sinon.SinonStatic; diff --git a/types/sinon/sinon-tests.ts b/types/sinon/sinon-tests.ts index c6ffc7a51e..17e8cc6084 100644 --- a/types/sinon/sinon-tests.ts +++ b/types/sinon/sinon-tests.ts @@ -154,15 +154,6 @@ function testSandbox() { sandbox.createStubInstance(TestCreateStubInstance).someTestMethod('some argument'); } -class OneFunctionOneNumber { - memberFunction() { } - memberNumber: number; -} - -const stubInstance = sinon.createStubInstance(OneFunctionOneNumber); -const memberFunction: sinon.SinonStub = stubInstance.memberFunction; -const memberNumber: number = stubInstance.memberNumber; - function testPromises() { let resolveStub = sinon.stub().resolves(); resolveStub = sinon.stub().resolves(10);