import sinon from "sinon"; import {SinonStub, SinonStubbedInstance} from "sinon"; export type SinonStubFn any> = T extends (...args: infer TArgs) => infer TReturnValue ? SinonStub : never; // eslint-disable-next-line @typescript-eslint/ban-types type StubbableType = Function & {prototype: TType}; export function createStubInstance(constructor: StubbableType): SinonStubbedInstance & TType { return sinon.createStubInstance(constructor) as SinonStubbedInstance & TType; } export type Mutable = Omit & {-readonly [key in K]: T[key]};