Merge pull request #20052 from backstage/rugvip/noparam

backend-test-utils: remove last type parameter for MockInstance
This commit is contained in:
Patrik Oldsberg
2023-09-20 20:14:55 +02:00
committed by GitHub
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];
};