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 issues for Pack and base type Minipass<ContiguousData, Buffer, WarnEvent> when using node v18 types #417

Closed
viceice opened this issue May 14, 2024 · 6 comments

Comments

@viceice
Copy link

viceice commented May 14, 2024

> pnpm test
node_modules/.pnpm/[email protected]/node_modules/tar/dist/commonjs/pack.d.ts:70:5 - error TS2416: Property 'end' in type 'Pack' is not assignable to the same property in base type 'Minipass<ContiguousData, Buffer, WarnEvent>'.
  Type '(path?: string | ReadEntry | undefined) => this' is not assignable to type '{ (cb?: (() => void) | undefined): this; (chunk: Buffer, cb?: (() => void) | undefined): this; (chunk: Buffer, encoding?: Encoding | undefined, cb?: (() => void) | undefined): this; }'.
    Types of parameters 'path' and 'cb' are incompatible.
      Type '(() => void) | undefined' is not assignable to type 'string | ReadEntry | undefined'.
        Type '() => void' is not assignable to type 'string | ReadEntry | undefined'.

70     end(path?: string | ReadEntry): this;
       ~~~

node_modules/.pnpm/[email protected]/node_modules/tar/dist/commonjs/pack.d.ts:71:5 - error TS2416: Property 'write' in type 'Pack' is not assignable to the same property in base type 'Minipass<ContiguousData, Buffer, WarnEvent>'.
  Type '(path: string | ReadEntry) => boolean' is not assignable to type '{ (chunk: Buffer, cb?: (() => void) | undefined): boolean; (chunk: Buffer, encoding?: Encoding | undefined, cb?: (() => void) | undefined): boolean; }'.
    Types of parameters 'path' and 'chunk' are incompatible.
      Type 'Buffer' is not assignable to type 'string | ReadEntry'.
        Type 'Buffer' is missing the following properties from type 'ReadEntry': #private, header, startBlockSize, blockRemain, and 75 more.

71     write(path: string | ReadEntry): boolean;
       ~~~~~


Found 2 errors in the same file, starting at: node_modules/.pnpm/[email protected]/node_modules/tar/dist/commonjs/pack.d.ts:70
@viceice viceice changed the title Typescript issues for Pack and base type Minipass<ContiguousData, Buffer, WarnEvent> when using nodwe v18 types Typescript issues for Pack and base type Minipass<ContiguousData, Buffer, WarnEvent> when using node v18 types May 14, 2024
Philipp15b added a commit to moves-rwth/caesar that referenced this issue May 18, 2024
it seems there is an incompatibility with new node types and typescript?
isaacs/node-tar#417
@Goodwine
Copy link

Repro steps were provided on another thread:

#413 (comment)

@isaacs
Copy link
Owner

isaacs commented Jun 7, 2024

Ah, yes this is a dupe, should be fixed in 7.2

@isaacs isaacs closed this as completed Jun 7, 2024
@torresgol10
Copy link

torresgol10 commented Jun 11, 2024

I have the same problem with the version [email protected], @types/[email protected] and [email protected].

How can I fix it?

[tsl] ERROR in /node_modules/.pnpm/[email protected]/node_modules/tar/dist/commonjs/pack.d.ts(70,5)
      TS2416: Property 'end' in type 'Pack' is not assignable to the same property in base type 'Minipass<ContiguousData, Buffer, WarnEvent>'.
  Type '(path?: string | ReadEntry | undefined) => this' is not assignable to type '{ (cb?: (() => void) | undefined): this; (chunk: Buffer, cb?: (() => void) | undefined): this; (chunk: Buffer, encoding?: Encoding | undefined, cb?: (() => void) | undefined): this; }'.
    Types of parameters 'path' and 'cb' are incompatible.
      Type '(() => void) | undefined' is not assignable to type 'string | ReadEntry | undefined'.
        Type '() => void' is not assignable to type 'string | ReadEntry | undefined'.

ERROR in /node_modules/.pnpm/[email protected]/node_modules/tar/dist/commonjs/pack.d.ts
71:4-9
[tsl] ERROR in /home/user/next.js/node_modules/.pnpm/[email protected]/node_modules/tar/dist/commonjs/pack.d.ts(71,5)
      TS2416: Property 'write' in type 'Pack' is not assignable to the same property in base type 'Minipass<ContiguousData, Buffer, WarnEvent>'.
  Type '(path: string | ReadEntry) => boolean' is not assignable to type '{ (chunk: Buffer, cb?: (() => void) | undefined): boolean; (chunk: Buffer, encoding?: Encoding | undefined, cb?: (() => void) | undefined): boolean; }'.
    Types of parameters 'path' and 'chunk' are incompatible.
      Type 'Buffer' is not assignable to type 'string | ReadEntry'.
        Type 'Buffer' is missing the following properties from type 'ReadEntry': #private, header, startBlockSize, blockRemain, and 75 more.

@stephematician
Copy link

I have the same problem with the version [email protected], @types/[email protected] and [email protected].

How can I fix it?

Same here, typescript @5.5.3, @types/[email protected], and [email protected].

@isaacs
Copy link
Owner

isaacs commented Jul 22, 2024

Reproduction case, please. This works fine for me.

@isaacs
Copy link
Owner

isaacs commented Jul 22, 2024

Actually, no, this issue is for tar 7.1, minipass 5, and @types/node v18.

@stephematician @pamelalozano16 Whatever problems you're having, they're not this issue, even if the error looks similar. Open a new issue with full detailed steps to reproduce what you are seeing, and I will gladly take a look.

Repository owner locked as resolved and limited conversation to collaborators Jul 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants