Type conflict when using vscode with node-fetch
I'm creating a nextjs app using vscode on Ubuntu 20.04 (WSL-2) in typescript and using Apollo Client & node-fetch. I'm getting a compile error:
Type 'Promise<import("/home/mwoodpatrick/projects/git/www/blog-series-nextjs-nx/node_modules/@types/node-fetch/index").Response>' is not assignable to type 'Promise<Response>'. Type 'Response' is missing the following properties from type 'Response': trailer, formData
It appears that there are incompatible definitions of "Promise<Response>"
https://github.com/microsoft/TypeScript/blob/main/lib/lib.dom.d.ts
versus
https://github.com/node-fetch/node-fetch/blob/main/%40types/index.d.ts
I would appreciate any suggestions on how to avoid this type of conflict.
Hi @mwoodpatrick , can you share your imports? I think I know the issue.
I'm running into the same issue here and see that the OP never responded. @schimini is there a particular import that you're looking for?
I have the following
import { ApiError } from "./ApiError";
import type { ApiRequestOptions } from "./ApiRequestOptions";
import type { ApiResult } from "./ApiResult";
import { OpenAPI } from "./OpenAPI";
import fetch from "node-fetch";