backend-test-utils: remove last type parameter for MockInstance

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-09-20 17:52:33 +02:00
parent 98a3055fa4
commit 5ddc03813e
3 changed files with 7 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-test-utils': patch
---
Remove third type parameter used for `MockInstance`, in order to be compatible with older versions of `@types/jest`.
+1 -2
View File
@@ -210,10 +210,9 @@ export type ServiceMock<TService> = {
factory: ServiceFactory<TService>;
} & {
[Key in keyof TService]: TService[Key] extends (
this: infer This,
...args: infer Args
) => infer Return
? TService[Key] & jest.MockInstance<Return, Args, This>
? TService[Key] & jest.MockInstance<Return, Args>
: TService[Key];
};
@@ -64,10 +64,9 @@ export type ServiceMock<TService> = {
factory: ServiceFactory<TService>;
} & {
[Key in keyof TService]: TService[Key] extends (
this: infer This,
...args: infer Args
) => infer Return
? TService[Key] & jest.MockInstance<Return, Args, This>
? TService[Key] & jest.MockInstance<Return, Args>
: TService[Key];
};