Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

TypeScript errors in index.d.ts #49

Closed
mjossdev opened this issue May 15, 2023 · 8 comments
Closed

TypeScript errors in index.d.ts #49

mjossdev opened this issue May 15, 2023 · 8 comments

Comments

@mjossdev
Copy link

Running tsc index.d.ts in version 6 of this package throws the following errors:

index.d.ts:140:3 - error TS2416: Property 'on' in type 'Minipass<RType, WType, Events>' is not assignable to the same property in base type 'Stream'.
  Type '<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any) => this' is not assignable to type '(eventName: string | symbol, listener: (...args: any[]) => void) => this'.
    Types of parameters 'ev' and 'eventName' are incompatible.
      Type 'string | symbol' is not assignable to type 'keyof Events'.
        Type 'symbol' is not assignable to type 'keyof Events'.
          Type 'symbol' is not assignable to type 'keyof Events<RType>'.

140   on<Event extends keyof Events>(
      ~~

index.d.ts:145:3 - error TS2416: Property 'once' in type 'Minipass<RType, WType, Events>' is not assignable to the same property in base type 'Stream'.
  Type '<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any) => this' is not assignable to type '(eventName: string | symbol, listener: (...args: any[]) => void) => this'.
    Types of parameters 'ev' and 'eventName' are incompatible.
      Type 'string | symbol' is not assignable to type 'keyof Events'.
        Type 'symbol' is not assignable to type 'keyof Events'.

145   once<Event extends keyof Events>(
      ~~~~

index.d.ts:150:3 - error TS2416: Property 'addListener' in type 'Minipass<RType, WType, Events>' is not assignable to the same property in base type 'Stream'.
  Type '<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any) => this' is not assignable to type '(eventName: string | symbol, listener: (...args: any[]) => void) => this'.
    Types of parameters 'ev' and 'eventName' are incompatible.
      Type 'string | symbol' is not assignable to type 'keyof Events'.
        Type 'symbol' is not assignable to type 'keyof Events'.

150   addListener<Event extends keyof Events>(
      ~~~~~~~~~~~

index.d.ts:155:3 - error TS2416: Property 'emit' in type 'Minipass<RType, WType, Events>' is not assignable to the same property in base type 'Stream'.
  Type '<Event extends keyof Events>(ev: Event, ...data: Events[Event]) => boolean' is not assignable to type '(eventName: string | symbol, ...args: any[]) => boolean'.
    Types of parameters 'ev' and 'eventName' are incompatible.
      Type 'string | symbol' is not assignable to type 'keyof Events'.
        Type 'symbol' is not assignable to type 'keyof Events'.

155   emit<Event extends keyof Events>(ev: Event, ...data: Events[Event]): boolean
      ~~~~

node_modules/@types/node/globals.d.ts:72:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'AbortSignal' must be of type '{ new (): AbortSignal; prototype: AbortSignal; abort(reason?: any): AbortSignal; timeout(milliseconds: number): AbortSignal; }', but here has type '{ new (): AbortSignal; prototype: AbortSignal; }'.

72 declare var AbortSignal: {
               ~~~~~~~~~~~

  ../../../../usr/lib/node_modules/typescript/lib/lib.dom.d.ts:2090:13
    2090 declare var AbortSignal: {
                     ~~~~~~~~~~~
    'AbortSignal' was also declared here.


Found 5 errors in 2 files.

Errors  Files
     4  index.d.ts:140
     1  node_modules/@types/node/globals.d.ts:72
@mjossdev
Copy link
Author

mjossdev commented May 15, 2023

I noticed this when I tried updating the glob npm package today.

@paulsmithkc
Copy link

Same issue with:

Node 18
Typescript 5
rimraf 5
minipass 6

@pepegc
Copy link

pepegc commented May 15, 2023

same issue, node 16.20... also from glob (^10.2.2)

@Goodwine
Copy link

Same, although I was able to get it to work by adding "skipLibCheck": true on my tsconfig. I don't think that's right, but that may help unblock someone.

@kaiyoma
Copy link

kaiyoma commented May 17, 2023

Also running into this. Node 16.19.1, TypeScript 4.9.5. Our project uses rimraf which pulls in minipass.

@isaacs isaacs closed this as completed in 0c7b958 May 17, 2023
isaacs added a commit to isaacs/node-glob that referenced this issue May 17, 2023
This requires the minipass with the fixed EventEmitter types, and also
the tsconfig setting that let the error slip past in the first place.

Re: #529
Re: isaacs/minipass#49
isaacs added a commit to isaacs/rimraf that referenced this issue May 17, 2023
This requires the minipass with the fixed EventEmitter types, and also
the tsconfig setting that let the error slip past in the first place.

Re: isaacs/node-glob#529
Re: isaacs/minipass#49
@paulsmithkc
Copy link

Issue remains unresolved. skipLibCheck=false only hides the error for now.

@mjossdev
Copy link
Author

@paulsmithkc Really? I just updated glob (and by extension minipass) in my project and I no longer get this error.

@isaacs
Copy link
Owner

isaacs commented May 18, 2023

Uhh, skipLibCheck=false would stop hiding the error?

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

Successfully merging a pull request may close this issue.

6 participants