fix(package.json): correct broken "types" path so TS consumers get types#484
Open
Dvir Arad (dvirarad) wants to merge 1 commit into
Open
fix(package.json): correct broken "types" path so TS consumers get types#484Dvir Arad (dvirarad) wants to merge 1 commit into
Dvir Arad (dvirarad) wants to merge 1 commit into
Conversation
The "types" field pointed to types/index.d.ts which does not exist; the root index.d.ts is the real types entry (re-exports types/rdkafka and types/kafkajs). This means TypeScript users currently get no types from the package. Closes confluentinc#403
There was a problem hiding this comment.
Pull request overview
This PR fixes TypeScript type resolution for @confluentinc/kafka-javascript by correcting the package.json types entry to point at the existing root index.d.ts (instead of the non-existent types/index.d.ts), addressing #403.
Changes:
- Update
package.json"types"field fromtypes/index.d.tstoindex.d.ts.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #403.
package.jsonadvertisesbut that file does not exist in the published package or in the repo. The actual type entry is the top-level
index.d.ts, which re-exports the per-module declarations:Impact
With the current
typespath pointing at a non-existent file, TypeScript consumers of@confluentinc/kafka-javascriptget no types at all when theyimport { ... } from '@confluentinc/kafka-javascript'— they seeanyeverywhere. Workarounds in the wild include"paths"shims or direct deep imports fromnode_modules/.../types/rdkafka, neither of which should be necessary. Maintainer Pratyush Ranjan (@PratRanj07) acknowledged the bug in #403 (internal ticket 4253).Verification
On
mastertoday (2026-05-11):The
types/directory exists and containsconfig.d.ts,errors.d.ts,kafkajs.d.ts,rdkafka.d.ts, etc., but there is noindex.d.tsinside it. The onlyindex.d.tsin the repo is at the root.Fix
One-line change in
package.json:index.d.tsis already shipped (it lives at the repo root and is not in.gitignore/files-excluded), so no other changes are needed. After this fix,tscresolves@confluentinc/kafka-javascriptto the existing rootindex.d.tsand downstream users get the fullRdKafka/KafkaJStypes.Test plan
curlconfirmsindex.d.tsexists andtypes/index.d.ts404s onmasternpm pack --dry-run(locally) showsindex.d.tsis included in the tarball alongsidetypes/*.d.tstest:typesscript (tsc -p .) still passes (no source change — only the manifest pointer moved)Happy to add a small consumer smoke-test (
tsc --noEmitagainst a tinyimport { KafkaJS } from '@confluentinc/kafka-javascript'stub) if maintainers want a regression guard.