unfetch icon indicating copy to clipboard operation
unfetch copied to clipboard

TypeScript Error: has no exported member 'Body'.

Open balupton opened this issue 5 years ago • 1 comments

$ cat node_modules/isomorphic-unfetch/package.json | grep version
  "version": "3.0.0",
$ tsc --noEmit --project .
node_modules/isomorphic-unfetch/index.d.ts:2:3 - error TS2305: Module '"../../../../../../../Users/balupton/Projects/meet/bevry-meet/node_modules/node-fetch/lib"' has no exported member 'Body'.

2   Body as NodeBody,
    ~~~~

node_modules/isomorphic-unfetch/index.d.ts:9:45 - error TS2749: 'NodeHeaders' refers to a value, but is being used as a type here.

9   export type IsomorphicHeaders = Headers | NodeHeaders;
                                              ~~~~~~~~~~~

node_modules/isomorphic-unfetch/index.d.ts:11:47 - error TS2749: 'NodeResponse' refers to a value, but is being used as a type here.

11   export type IsomorphicResponse = Response | NodeResponse;
                                                 ~~~~~~~~~~~~

node_modules/isomorphic-unfetch/index.d.ts:12:45 - error TS2749: 'NodeRequest' refers to a value, but is being used as a type here.

12   export type IsomorphicRequest = Request | NodeRequest
                                               ~~~~~~~~~~~


Found 4 errors.
$ cat node_modules/isomorphic-unfetch/index.d.ts 
import {
  Body as NodeBody,
  Headers as NodeHeaders,
  Request as NodeRequest,
  Response as NodeResponse
} from "node-fetch";

declare namespace unfetch {
  export type IsomorphicHeaders = Headers | NodeHeaders;
  export type IsomorphicBody = Body | NodeBody;
  export type IsomorphicResponse = Response | NodeResponse;
  export type IsomorphicRequest = Request | NodeRequest
}

declare const unfetch: typeof fetch;

export default unfetch;
> cat node_modules/node-fetch/package.json | grep version
  "version": "2.6.0",

balupton avatar Aug 13 '19 16:08 balupton

Curious if this still happens in 3.1.0, since it includes #117.

developit avatar Sep 29 '20 18:09 developit

This should be fixed as of isomorphic-unfetch 4.0.1.

developit avatar Dec 31 '22 04:12 developit