mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-06 05:48:00 +03:00
13 lines
373 B
TypeScript
13 lines
373 B
TypeScript
import nodeFetch from "node-fetch";
|
|
|
|
const fetch =
|
|
process.env.NODE_ENV === "test"
|
|
? () => {
|
|
throw new Error("Cannot use real fetch inside testing env!");
|
|
}
|
|
: nodeFetch;
|
|
|
|
export type NodeFetch = (url: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
|
|
|
|
export default (fetch as unknown) as NodeFetch;
|