Skip to content

Commit 0f50011

Browse files
committed
fix cast rest and batchRest
1 parent d11eee2 commit 0f50011

File tree

1 file changed

+5
-14
lines changed
  • packages/e2e-test-utils-playwright/src/request-utils

1 file changed

+5
-14
lines changed

packages/e2e-test-utils-playwright/src/request-utils/index.ts

+5-14
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,7 @@ import { WP_ADMIN_USER, WP_BASE_URL } from '../config';
1313
import type { User } from './login';
1414
import { login } from './login';
1515
import { listMedia, uploadMedia, deleteMedia, deleteAllMedia } from './media';
16-
import {
17-
setupRest,
18-
rest,
19-
getMaxBatchSize,
20-
batchRest,
21-
RestOptions,
22-
BatchRequest,
23-
} from './rest';
16+
import { setupRest, rest, getMaxBatchSize, batchRest } from './rest';
2417
import { getPluginsMap, activatePlugin, deactivatePlugin } from './plugins';
2518
import { deleteAllTemplates } from './templates';
2619
import { activateTheme } from './themes';
@@ -117,13 +110,11 @@ class RequestUtils {
117110

118111
login = login.bind( this );
119112
setupRest = setupRest.bind( this );
120-
rest = rest.bind( this ) as < RestResponse = any >(
121-
options: RestOptions
122-
) => Promise< RestResponse >;
113+
// .bind() drops the generic types. Re-casting it to keep the type signature.
114+
rest = rest.bind( this ) as typeof rest;
123115
getMaxBatchSize = getMaxBatchSize.bind( this );
124-
batchRest = batchRest.bind( this ) as < BatchResponse >(
125-
requests: BatchRequest[]
126-
) => Promise< BatchResponse[] >;
116+
// .bind() drops the generic types. Re-casting it to keep the type signature.
117+
batchRest = batchRest.bind( this ) as typeof batchRest;
127118
getPluginsMap = getPluginsMap.bind( this );
128119
activatePlugin = activatePlugin.bind( this );
129120
deactivatePlugin = deactivatePlugin.bind( this );

0 commit comments

Comments
 (0)