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?

image/svg+xml Follow

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

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

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)