Skip to content

Type Definition Error in AMQPView Class #125

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

Closed
kileha3 opened this issue Dec 8, 2024 · 2 comments · Fixed by #129
Closed

Type Definition Error in AMQPView Class #125

kileha3 opened this issue Dec 8, 2024 · 2 comments · Fixed by #129

Comments

@kileha3
Copy link

kileha3 commented Dec 8, 2024

When using @cloudamqp/amqp-client, there's a TypeScript compilation error in the type definitions file at node_modules/@cloudamqp/amqp-client/types/amqp-view.d.ts. The error occurs on line 8 where the AMQPView class extends DataView. TypeScript reports error TS2508: "No base constructor has the specified number of type arguments."

Technical Details:

  • Error Code: TS2508
  • File: node_modules/@cloudamqp/amqp-client/types/amqp-view.d.ts
  • Line: 8
  • Problematic Code: export declare class AMQPView extends DataView

The error occurs because the code attempts to extend JavaScript's built-in DataView class as if it accepts type parameters, which it doesn't. The DataView interface is part of TypeScript's lib.es5.d.ts definitions and is defined as a class without any type parameters.

To resolve this issue, the type definition should be modified to extend DataView without any type arguments, maintaining consistency with the standard JavaScript DataView implementation.

Environment:

  • Package: @cloudamqp/amqp-client
  • TypeScript: Compilation targets ES5 or higher
  • Error reproducible in strict type-checking mode
@san4io
Copy link

san4io commented Feb 17, 2025

tsconfig:

"skipLibCheck": true

@carlhoerberg
Copy link
Member

In typescript 5.7 we have to change extend DataView to extend DataView<Uint8Array['buffer']> for some reason, opening a PR. microsoft/TypeScript#60808 (comment)

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.

3 participants