confluent-kafka-javascript icon indicating copy to clipboard operation
confluent-kafka-javascript copied to clipboard

Missing Type Definition File Referenced in package.json for @confluentinc/[email protected]

Open tarasvalstro opened this issue 1 month ago • 0 comments

Summary

The package.json for @confluentinc/[email protected] references a non-existent type definition file (types/index.d.ts), causing TypeScript to fail when resolving types and namespace exports.

Details

When analyzing the package using arethetypeswrong, the tool reports a missing named exports. Upon inspection of the package:

  1. The Problem: The package.json specifies "types": "types/index.d.ts", but this file does not exist in the published package.
  2. Actual Structure: The type definitions are located at index.d.ts in the root directory, which exports:
    export * from './types/rdkafka';
    export * as RdKafka from './types/rdkafka';
    export * as KafkaJS from './types/kafkajs';
    
  3. Impact: Because TypeScript cannot find the file specified in the types field, it fails to resolve:
    • The namespace exports (RdKafka and KafkaJS)
    • All type definitions from the package
    • IntelliSense and type checking for consumers

Impact

  • TypeScript projects consuming this package will experience:
    • Complete failure to resolve type definitions
    • Missing IntelliSense/autocomplete support
    • TypeScript compiler errors when importing from the package
    • Inability to use namespace exports (RdKafka.* and KafkaJS.*)

Expected Behavior

The package.json types field should point to an existing type definition file that TypeScript can resolve.

Actual Behavior

The package.json points to types/index.d.ts which does not exist, causing TypeScript to fail when trying to resolve types and namespace exports.

Steps to Reproduce

  1. Install @confluentinc/[email protected]:
    npm install @confluentinc/[email protected]
    
  2. Extract and inspect the package:
    npm pack @confluentinc/[email protected]
    tar -xzf confluentinc-kafka-javascript-1.6.0.tgz
    ls package/types/index.d.ts  # This file does not exist
    
  3. Check package.json:
    {
      "types": "types/index.d.ts"  // Points to non-existent file
    }
    
  4. Analyze using arethetypeswrong
  5. Observe the missing namespace/type resolution error

Environment

Additional Context

The root index.d.ts file exists and contains the proper type exports, including namespace exports using export * as. However, because the package.json types field points to a non-existent path, TypeScript cannot resolve these exports.

Related

PS: this issue description was generated with AI, so take it with a grain of salt

tarasvalstro avatar Nov 20 '25 17:11 tarasvalstro