File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 44 * SPDX-License-Identifier: BSD-3-Clause
55 * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66 */
7- import type { FetchFunction , FetchOptions } from '../clientConfig' ;
7+ import type { FetchFunction } from '../clientConfig' ;
88
99/*
1010 * Copyright (c) 2022, Salesforce, Inc.
@@ -24,8 +24,6 @@ export const globalObject = isBrowser ? window : globalThis;
2424
2525export const hasFetchAvailable = typeof globalObject . fetch === 'function' ;
2626
27- let lazyFetch : FetchFunction ;
28-
2927// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
3028export const fetch : FetchFunction = ( ( ) => {
3129 if ( isNode ) {
@@ -40,13 +38,12 @@ export const fetch: FetchFunction = (() => {
4038 throw new Error (
4139 'Bad environment: it is not a node environment but fetch is not defined'
4240 ) ;
43- return (
44- input : RequestInfo ,
45- init ?: FetchOptions | undefined
46- ) : Promise < Response > => {
41+ let lazyFetch : FetchFunction ;
42+ const browserFetch : FetchFunction = ( ...args ) => {
4743 if ( ! lazyFetch ) {
4844 lazyFetch = globalObject . fetch ;
4945 }
50- return lazyFetch . apply ( globalObject , [ input , init ] ) ;
46+ return lazyFetch . apply ( globalObject , args ) ;
5147 } ;
48+ return browserFetch ;
5249} ) ( ) ;
You can’t perform that action at this time.
0 commit comments