-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: proper exports to allow TS to recognize class types and proper c…
…asting (#71) Co-authored-by: Jacob Ebey <[email protected]>
- Loading branch information
1 parent
c74db27
commit 9e95faf
Showing
1 changed file
with
5 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import * as WebFetch from "./fetch.js" | ||
import { fetch as webFetch, Headers as WebHeaders, Request as WebRequest, Response as WebResponse } from "./fetch.js" | ||
|
||
export { ReadableStream, Blob, FormData } from './package.js'; | ||
// Electron-renderer should get the browser implementation instead of node | ||
// Browser configuration is not enough | ||
|
||
// Marking export as a DOM File object instead of custom class. | ||
export const fetch = /** @type {typeof globalThis.fetch} */ | ||
(typeof globalThis.fetch === "function" ? globalThis.fetch.bind(globalThis) : WebFetch.fetch) | ||
(typeof globalThis.fetch === "function" ? globalThis.fetch.bind(globalThis) : webFetch) | ||
|
||
export const Headers = globalThis.Headers || WebFetch.Headers | ||
export const Request = globalThis.Request || WebFetch.Request | ||
export const Response = globalThis.Response || WebFetch.Response | ||
export const Headers = globalThis.Headers || WebHeaders | ||
export const Request = globalThis.Request || WebRequest | ||
export const Response = globalThis.Response || WebResponse | ||
|
||
export default fetch |