Fix: narrow beforeRequest hook type to avoid boolean in array (#23860)

Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
Co-authored-by: Yongtao Huang <99629139+hyongtao-db@users.noreply.github.com>
This commit is contained in:
Yongtao Huang 2025-08-13 23:28:13 +08:00 committed by GitHub
parent b6bd145130
commit 02194db0c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -162,7 +162,7 @@ async function base<T>(url: string, options: FetchOptionType = {}, otherOptions:
...baseHooks.beforeRequest || [], ...baseHooks.beforeRequest || [],
isPublicAPI && beforeRequestPublicAuthorization, isPublicAPI && beforeRequestPublicAuthorization,
!isPublicAPI && !isMarketplaceAPI && beforeRequestAuthorization, !isPublicAPI && !isMarketplaceAPI && beforeRequestAuthorization,
].filter(Boolean), ].filter((h): h is BeforeRequestHook => Boolean(h)),
afterResponse: [ afterResponse: [
...baseHooks.afterResponse || [], ...baseHooks.afterResponse || [],
afterResponseErrorCode(otherOptions), afterResponseErrorCode(otherOptions),