diff --git a/src/utils/connect/fetch.ts b/src/utils/connect/fetch.ts index a301db549..9ff888241 100644 --- a/src/utils/connect/fetch.ts +++ b/src/utils/connect/fetch.ts @@ -1,8 +1,8 @@ import { LibraryError } from '../errors'; -export default (typeof globalThis !== 'undefined' && globalThis.fetch.bind(globalThis)) || - (typeof window !== 'undefined' && window.fetch.bind(window)) || - (typeof global !== 'undefined' && global.fetch.bind(global)) || +export default (typeof globalThis?.fetch !== 'undefined' && globalThis.fetch.bind(globalThis)) || + (typeof window?.fetch !== 'undefined' && window.fetch.bind(window)) || + (typeof global?.fetch !== 'undefined' && global.fetch.bind(global)) || ((() => { throw new LibraryError( "'fetch()' not detected, use the 'baseFetch' constructor parameter to set it"