Skip to content

Problems with node-fetch package #227

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
neSpecc opened this issue Aug 22, 2022 · 0 comments · Fixed by #228
Closed

Problems with node-fetch package #227

neSpecc opened this issue Aug 22, 2022 · 0 comments · Fixed by #228

Comments

@neSpecc
Copy link
Member

neSpecc commented Aug 22, 2022

Problem description

  1. Used version of the node-fetch contains own declaration of the AbortController types that is incompatible with the native declaration. It leads to the TS error:
Type 'AbortSignal' is not assignable to type 'import("/Users/specc/codex/docs/node_modules/@types/node-fetch/externals").AbortSignal'.
  Types of property 'onabort' are incompatible.
    Type '((this: AbortSignal, ev: Event) => any) | null' is not assignable to type '((this: AbortSignal, event: any) => void) | null'.
      Type '(this: AbortSignal, ev: Event) => any' is not assignable to type '(this: AbortSignal, event: any) => void'.
        The 'this' types of each signature are incompatible.
          Type 'AbortSignal' is missing the following properties from type 'AbortSignal': reason, throwIfAbortedts(2322)

image

See the related issue node-fetch/node-fetch#741
That problem fixed in one of 3.* version

  1. But the 3+ version is incompatible with our app because it does not support Common JS projects.

Possible solutions

  1. Update node-fetch to the latest version. Set "type": "module" in package.json. Then update all application imports, fix possible problems.
  2. Change node-fetch to axios or other tool
  3. Other?

Also, see this issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant