fent / node-miniget

A small http(s) GET library.
MIT License
53 stars 17 forks source link

incompatible with @types/node v17.0.6 or later #65

Closed mtripg6666tdr closed 2 years ago

mtripg6666tdr commented 2 years ago

the code is incompatible with @types/node v17.0.6 or later. Probably because of changed PassThrough definition. How to reproduce:

git clone https://github.com/fent/node-miniget.git
cd node-miniget
npm i
npm i @types/node@latest
npm run build

Complete error:

src/index.ts:40:20 - error TS2430: Interface 'Stream' incorrectly extends interface 'PassThrough'.
  The types returned by 'destroy(...)' are incompatible between these types.
    Type 'void' is not assignable to type 'this'.
      'this' could be instantiated with an arbitrary type which could be unrelated to 'void'.

40   export interface Stream extends PassThrough {
                      ~~~~~~

src/index.ts:70:18 - error TS2352: Conversion of type 'PassThrough' to type 'Stream' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Type 'PassThrough' is missing the following properties from type 'Stream': abort, aborted, text

70   const stream = new PassThrough({ highWaterMark: opts.highWaterMark }) as Miniget.Stream;
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 2 errors.
mtripg6666tdr commented 2 years ago

This affects all TypeScript projects that use miniget with these versions of @types/node I know should modify Stream class definition, but i don't know where and how to modify for me (to keep compatible with older versions)

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 4.2.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

fent commented 2 years ago

let me know if that worked

mtripg6666tdr commented 2 years ago

Thank you for your rapid response at all. but it seems there's the same issue in m3u8stream... Would it be better if I open an issue in m3u8stream repository?

fent commented 2 years ago

yeah i saw it. will try to fix it in the next day or so. but if i don't, feel free to remind me by opening an issue

mtripg6666tdr commented 2 years ago

ok thanks for your kindness!

mtripg6666tdr commented 2 years ago

I'm glad to let you know that all worked successfully; I appreciate your help. (*・ω・)*_ _)