[Part of #176153] Server mocks (#179756)

This commit is contained in:
Alejandro Fernández Haro 2024-04-02 11:17:03 +02:00 committed by GitHub
parent a38196699e
commit 3497a5da79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -145,8 +145,9 @@ export type CustomRequestHandlerMock<T> = {
[Key in keyof T]: T[Key] extends Promise<unknown> ? T[Key] : Promise<T[Key]>;
};
const createCustomRequestHandlerContextMock = <T>(contextParts: T): CustomRequestHandlerMock<T> => {
// @ts-expect-error upgrade typescript v4.9.5
const createCustomRequestHandlerContextMock = <T extends Record<string, unknown>>(
contextParts: T
): CustomRequestHandlerMock<T> => {
const mock = Object.entries(contextParts).reduce(
(context, [key, value]) => {
// @ts-expect-error type matching from inferred types is hard

View file

@ -28,7 +28,7 @@ export const createMockClients = () => {
type MockClients = ReturnType<typeof createMockClients>;
const convertRequestContextMock = <T>(context: T) => {
const convertRequestContextMock = <T extends Record<string, unknown>>(context: T) => {
return coreMock.createCustomRequestHandlerContext(context);
};