Skip to content

error TS2315: Type 'Buffer' is not generic #216

Closed
@apeloquin-agilysys

Description

@apeloquin-agilysys

Environment Information

  • OS: Mac M3 Sonoma 14.6.1
  • Node Version: 20.14.0
  • NPM Version: 10.7.0
  • confluent-kafka-javascript version: 0.5.2

Steps to Reproduce

Update existing Typescript app with schemaregistry dependency from 0.6.1 to 1.0.0 and compile.

> tsc --outDir ./dist --project ./tsconfig.json

../../node_modules/@confluentinc/schemaregistry/dist/rules/encryption/encrypt-executor.d.ts:41:32 - error TS2315: Type 'Buffer' is not generic.

41     static readonly EMPTY_AAD: Buffer<ArrayBuffer>;
                                  ~~~~~~~~~~~~~~~~~~~

../../node_modules/@confluentinc/schemaregistry/dist/serde/serde.d.ts:8:34 - error TS2315: Type 'Buffer' is not generic.

8 export declare const MAGIC_BYTE: Buffer<ArrayBuffer>;
                                   ~~~~~~~~~~~~~~~~~~~


Found 2 errors in 2 files.

Errors  Files
     1  ../../node_modules/@confluentinc/schemaregistry/dist/rules/encryption/encrypt-executor.d.ts:41
     1  ../../node_modules/@confluentinc/schemaregistry/dist/serde/serde.d.ts:8
npm error Lifecycle script `build` failed with error:
npm error Error: command failed

This can be worked around by enabling skipLibCheck in the tsconfig.json...

  "compilerOptions": {
    "skipLibCheck": true
  }

...but that feels like bypassing a legitimate type issue.

As the error says the built-in Buffer type doesn't support generics and I can't find any definition of a non-built-in Buffer type in the project.

$ grep  -r "Buffer<" .
./dist/rules/encryption/encrypt-executor.d.ts:    static readonly EMPTY_AAD: Buffer<ArrayBuffer>;
./dist/serde/serde.d.ts:export declare const MAGIC_BYTE: Buffer<ArrayBuffer>;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions