I want to use `node-fetch` because Node.js annoyingly does not have `fetch`, but TypeScript keeps complaining `fetch` was also declared in lib.dom.d.ts. This is a Node.js-only app, which does not have DOM. How do I fix this other than renaming the import?

Answer: in tsconfig.json, add compilerOptions.lib = ["es2018"]

The lack of `"dom"` will remove `window` globals.

Show thread
Sign in to participate in the conversation
Librem Social

Librem Social is an opt-in public network. Messages are shared under Creative Commons BY-SA 4.0 license terms. Policy.

Stay safe. Please abide by our code of conduct.

(Source code)

image/svg+xml Librem Chat image/svg+xml