From 7f3cd68ef31b4e277bd80e06848995d4c127c6ff Mon Sep 17 00:00:00 2001 From: Alex Povar <1074182+zvirja@users.noreply.github.com> Date: Tue, 1 Oct 2019 18:37:37 +0200 Subject: [PATCH] Fix jasminewd2 compatibility with older jasmine versions (#38737) --- types/jasmine/ts3.1/index.d.ts | 3 --- types/jasminewd2/index.d.ts | 10 +++++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/types/jasmine/ts3.1/index.d.ts b/types/jasmine/ts3.1/index.d.ts index 34757496e0..96a2c9861f 100644 --- a/types/jasmine/ts3.1/index.d.ts +++ b/types/jasmine/ts3.1/index.d.ts @@ -617,9 +617,6 @@ declare namespace jasmine { type MatchableArgs = Fn extends (...args: infer P) => any ? { [K in keyof P]: P[K] | AsymmetricMatcher } : never; interface FunctionMatchers extends Matchers { - toHaveBeenCalled(): boolean; - toHaveBeenCalledBefore(expected: Func): boolean; - toHaveBeenCalledTimes(expected: number): boolean; toHaveBeenCalledWith(...params: MatchableArgs): boolean; /** diff --git a/types/jasminewd2/index.d.ts b/types/jasminewd2/index.d.ts index de136639f5..dcea91db77 100644 --- a/types/jasminewd2/index.d.ts +++ b/types/jasminewd2/index.d.ts @@ -5,7 +5,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -/// +/// declare function it(expectation: string, assertion?: (done: DoneFn) => Promise, timeout?: number): void; declare function fit(expectation: string, assertion?: (done: DoneFn) => Promise, timeout?: number): void; @@ -47,6 +47,14 @@ declare namespace jasmine { not: ArrayLikeMatchers; } + // Add definition to be compatible with latest jasmine v3 types. + // Even though library is not compatible with jasmine v3, there is no suitable way to configure that now here. + // See for more detail: https://github.com/microsoft/dtslint/issues/253 + interface FunctionMatchers any> extends Matchers { + toHaveBeenCalledWith(...params: any[]): boolean; + toHaveBeenCalledWith(...params: any[]): Promise; + } + function addMatchers(matchers: AsyncCustomMatcherFactories): void; interface Env {