Skip to content

Commit

Permalink
fix: proper exports to allow TS to recognize class types and proper c…
Browse files Browse the repository at this point in the history
…asting (#71)

Co-authored-by: Jacob Ebey <[email protected]>
  • Loading branch information
MichaelDeBoey and jacob-ebey authored Aug 28, 2023
1 parent c74db27 commit 9e95faf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/fetch/src/lib.node.js
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

0 comments on commit 9e95faf

Please sign in to comment.